Commit | Line | Data |
---|---|---|
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 | 36 | This manual is for Org (version @value{VERSION}). |
4009494e | 37 | |
dbc28aaa | 38 | Copyright @copyright{} 2004, 2005, 2006, 2007, 2008 Free Software Foundation |
4009494e GM |
39 | |
40 | @quotation | |
41 | Permission is granted to copy, distribute and/or modify this document | |
5b14aca9 | 42 | under the terms of the GNU Free Documentation License, Version 1.2 or |
4009494e GM |
43 | any later version published by the Free Software Foundation; with no |
44 | Invariant Sections, with the Front-Cover texts being ``A GNU Manual,'' | |
45 | and with the Back-Cover Texts as in (a) below. A copy of the | |
46 | license is included in the section entitled ``GNU Free Documentation | |
5b14aca9 | 47 | License'' in the Emacs manual. |
4009494e | 48 | |
6f093307 GM |
49 | (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and |
50 | modify this GNU manual. Buying copies from the FSF supports it in | |
51 | developing GNU and promoting software freedom.'' | |
5b14aca9 GM |
52 | |
53 | This document is part of a collection distributed under the GNU Free | |
54 | Documentation License. If you want to distribute this document | |
55 | separately from the collection, you can do so by adding a copy of the | |
56 | license 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 | ||
105 | Introduction | |
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 | |
113 | Document 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 | |
126 | Archiving | |
127 | ||
128 | * ARCHIVE tag:: Marking a tree as inactive | |
129 | * Moving subtrees:: Moving a tree to an archive file | |
130 | ||
131 | Tables | |
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 | |
139 | The 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 | ||
150 | Hyperlinks | |
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 | |
161 | Internal links | |
162 | ||
a7808fba | 163 | * Radio targets:: Make targets trigger links in plain text |
4009494e | 164 | |
a7808fba | 165 | TODO 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 | ||
174 | Extended 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 | 183 | Progress 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 | |
188 | Tags | |
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 | ||
194 | Properties 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 | 203 | Column 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 | 209 | Defining columns |
4009494e GM |
210 | |
211 | * Scope of column definitions:: Where defined, where valid? | |
212 | * Column attributes:: Appearance and content of a column | |
213 | ||
dbc28aaa | 214 | Dates 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 | |
222 | Creating 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 | 227 | Deadlines and scheduling |
4009494e GM |
228 | |
229 | * Inserting deadline/schedule:: Planning items | |
230 | * Repeated tasks:: Items that show up again and again | |
231 | ||
dbc28aaa | 232 | Remember |
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 | |
239 | Agenda 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 | |
249 | The 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 | ||
258 | Presentation 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 | ||
264 | Custom 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 | |
272 | Embedded 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 | ||
280 | Exporting | |
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 | ||
289 | HTML 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 | |
298 | LaTeX 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 | |
304 | Text 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 | ||
313 | Publishing | |
314 | ||
315 | * Configuration:: Defining projects | |
316 | * Sample configuration:: Example projects | |
317 | * Triggering publication:: Publication commands | |
318 | ||
319 | Configuration | |
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 | ||
329 | Sample configuration | |
330 | ||
331 | * Simple example:: One-component publishing | |
332 | * Complex example:: A multi-component publishing example | |
333 | ||
334 | Miscellaneous | |
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 | ||
345 | Interaction with other packages | |
346 | ||
a7808fba | 347 | * Cooperation:: Packages Org cooperates with |
4009494e GM |
348 | * Conflicts:: Packages that lead to conflicts |
349 | ||
350 | Extensions, 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 | 359 | Tables 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 | 385 | Org is a mode for keeping notes, maintaining TODO lists, and doing |
4009494e GM |
386 | project planning with a fast and effective plain-text system. |
387 | ||
a7808fba CD |
388 | Org develops organizational tasks around NOTES files that contain |
389 | lists or information about projects as plain text. Org is | |
390 | implemented on top of Outline mode, which makes it possible to keep the | |
4009494e GM |
391 | content of large files well structured. Visibility cycling and |
392 | structure editing help to work with the tree. Tables are easily created | |
a7808fba | 393 | with a built-in table editor. Org supports TODO items, deadlines, |
4009494e GM |
394 | time stamps, and scheduling. It dynamically compiles entries into an |
395 | agenda that utilizes and smoothly integrates much of the Emacs calendar | |
396 | and diary. Plain text URL-like links connect to websites, emails, | |
397 | Usenet messages, BBDB entries, and any files related to the projects. | |
a7808fba | 398 | For printing and sharing of notes, an Org file can be exported as a |
dbc28aaa | 399 | structured ASCII file, as HTML, or (TODO and agenda items only) as an |
4009494e | 400 | iCalendar file. It can also serve as a publishing tool for a set of |
a7808fba | 401 | linked web pages. |
4009494e | 402 | |
a7808fba | 403 | An important design aspect that distinguishes Org from for example |
4009494e GM |
404 | Planner/Muse is that it encourages to store every piece of information |
405 | only once. In Planner, you have project pages, day pages and possibly | |
a7808fba | 406 | other files, duplicating some information such as tasks. In Org, |
4009494e GM |
407 | you only have notes files. In your notes you mark entries as tasks, |
408 | label them with tags and timestamps. All necessary lists like a | |
409 | schedule for the day, the agenda for a meeting, tasks lists selected by | |
410 | tags etc are created dynamically when you need them. | |
411 | ||
a7808fba | 412 | Org keeps simple things simple. When first fired up, it should |
4009494e GM |
413 | feel like a straightforward, easy to use outliner. Complexity is not |
414 | imposed, but a large amount of functionality is available when you need | |
a7808fba | 415 | it. Org is a toolbox and can be used in different ways, for |
4009494e GM |
416 | example 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 | 430 | Org's automatic, context sensitive table editor with spreadsheet |
4009494e | 431 | capabilities can be integrated into any major mode by activating the |
a7808fba | 432 | minor Orgtbl mode. Using a translation step, it can be used to maintain |
4009494e | 433 | tables in arbitrary file types, for example in La@TeX{}. The structure |
a7808fba CD |
434 | editing and list creation capabilities can be used outside Org with |
435 | the minor Orgstruct mode. | |
4009494e GM |
436 | |
437 | @cindex FAQ | |
a7808fba CD |
438 | There is a website for Org which provides links to the newest |
439 | version of Org, as well as additional information, frequently asked | |
4009494e | 440 | questions (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 |
452 | XEmacs package, please skip this section and go directly to |
453 | @ref{Activation}.} | |
454 | ||
a7808fba CD |
455 | If you have downloaded Org from the Web, either as a distribution @file{.zip} |
456 | or @file{.tar} file, or as a GIT archive, you must take the following steps | |
457 | to install it: Go into the unpacked Org distribution directory and edit the | |
458 | top section of the file @file{Makefile}. You must set the name of the Emacs | |
459 | binary (likely either @file{emacs} or @file{xemacs}), and the paths to the | |
460 | directories where local Lisp and Info files are kept. If you don't have | |
461 | access to the system-wide directories, you can simply run Org directly from | |
462 | the distribution directory by adding the @file{lisp} subdirectory to the | |
463 | Emacs 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 | |
470 | If you plan to use code from the @file{contrib} subdirectory, do a similar | |
471 | step 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 | 478 | the @file{xemacs} sub-directory of the Org distribution. Use the |
4009494e GM |
479 | command:} |
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 | |
488 | make | |
4009494e GM |
489 | @end example |
490 | ||
a7808fba CD |
491 | @noindent If you are running Org from the distribution directory, this is |
492 | all. If you want to install into the system directories, use | |
4009494e GM |
493 | |
494 | @example | |
a7808fba | 495 | make install |
4009494e GM |
496 | make 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 | |
516 | PDF documentation as viewed by Acrobat reader to your .emacs file, the | |
517 | single quote character comes out incorrectly and the code will not work. | |
518 | You need to fix the single quotes by hand, or copy from Info | |
519 | documentation.} | |
520 | @end iftex | |
521 | ||
522 | Add the following lines to your @file{.emacs} file. The last two lines | |
a7808fba CD |
523 | define @emph{global} keys for the commands @command{org-store-link}, |
524 | @command{org-agenda}, and @command{org-iswitchb} - please choose suitable | |
525 | keys 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 | 535 | Furthermore, you must activate @code{font-lock-mode} in Org |
4009494e GM |
536 | buffers, because significant functionality depends on font-locking being |
537 | active. 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 | 545 | With this setup, all files with extension @samp{.org} will be put |
a7808fba | 546 | into Org mode. As an alternative, make the first line of a file look |
4009494e GM |
547 | like this: |
548 | ||
549 | @example | |
550 | MY PROJECTS -*- mode: org; -*- | |
551 | @end example | |
552 | ||
a7808fba | 553 | @noindent which will select Org mode for this buffer no matter what |
4009494e GM |
554 | the 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 | 564 | If you find problems with Org, or if you have questions, remarks, |
4009494e GM |
565 | or ideas about it, please contact the maintainer @value{MAINTAINER} at |
566 | @value{MAINTAINEREMAIL}. | |
567 | ||
568 | For bug reports, please provide as much information as possible, | |
569 | including 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 |
571 | the Org related setup in @file{.emacs}. If an error occurs, a | |
4009494e GM |
572 | backtrace can be very useful (see below on how to create one). Often a |
573 | small 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 | 585 | If working with Org produces an error with a message you don't |
4009494e GM |
586 | understand, you may have hit a bug. The best way to report this is by |
587 | providing, in addition to what was mentioned above, a @emph{Backtrace}. | |
588 | This is information from the built-in debugger about where and how the | |
589 | error occurred. Here is how to produce a useful backtrace: | |
590 | ||
591 | @enumerate | |
592 | @item | |
593 | Start a fresh Emacs or XEmacs, and make sure that it will load the | |
594 | original 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 | |
596 | produced with uncompiled code. To do this, either rename @file{org.elc} | |
597 | to something else before starting Emacs, or ask Emacs explicitly to load | |
598 | @file{org.el} by using the command line | |
599 | @example | |
600 | emacs -l /path/to/org.el | |
601 | @end example | |
602 | @item | |
603 | Go 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 | |
606 | Do whatever you have to do to hit the error. Don't forget to | |
607 | document the steps you take. | |
608 | @item | |
609 | When you hit the error, a @file{*Backtrace*} buffer will appear on the | |
610 | screen. Save this buffer to a file (for example using @kbd{C-x C-w}) and | |
611 | attach 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 | 617 | Org uses three types of keywords: TODO keywords, tags, and property |
dbc28aaa CD |
618 | names. In this manual we use the following conventions: |
619 | ||
620 | @table @code | |
621 | @item TODO | |
622 | @itemx WAITING | |
623 | TODO keywords are written with all capitals, even if they are | |
624 | user-defined. | |
625 | @item boss | |
626 | @itemx ARCHIVE | |
627 | User-defined tags are written in lowercase; built-in tags with special | |
628 | meaning are written with all capitals. | |
629 | @item Release | |
630 | @itemx PRIORITY | |
631 | User-defined properties are capitalized; built-in properties with | |
632 | special 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 | 640 | Org is based on outline mode and provides flexible commands to |
4009494e GM |
641 | edit 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 | 661 | Org is implemented on top of Outline mode. Outlines allow a |
4009494e GM |
662 | document to be organized in a hierarchical structure, which (at least |
663 | for me) is the best representation of notes and thoughts. An overview | |
664 | of this structure is achieved by folding (hiding) large parts of the | |
665 | document to show only the general document structure and the parts | |
a7808fba | 666 | currently being worked on. Org greatly simplifies the use of |
4009494e GM |
667 | outlines by compressing the entire show/hide functionality into a single |
668 | command @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 | ||
675 | Headlines define the structure of an outline tree. The headlines in | |
a7808fba | 676 | Org start with one or more stars, on the left margin@footnote{See |
4009494e GM |
677 | the variable @code{org-special-ctrl-a/e} to configure special behavior |
678 | of @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 | |
692 | outline that has whitespace followed by a single star as headline | |
693 | starters. @ref{Clean view} describes a setup to realize this. | |
694 | ||
695 | An empty line after the end of a subtree is considered part of it and | |
696 | will be hidden when the subtree is folded. However, if you leave at | |
697 | least two empty lines, one empty line will remain visible after folding | |
698 | the subtree, in order to structure the collapsed view. See the | |
699 | variable @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 | ||
709 | Outlines make it possible to hide parts of the text in the buffer. | |
a7808fba | 710 | Org 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 | ||
728 | The cursor must be on a headline for this to work@footnote{see, however, | |
729 | the option @code{org-cycle-emulate-tab}.}. When the cursor is at the | |
730 | beginning of the buffer and the first line is not a headline, then | |
731 | @key{TAB} actually runs global cycling (see below)@footnote{see the | |
732 | option @code{org-cycle-global-at-bob}.}. Also when called with a prefix | |
733 | argument (@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 |
750 | When @kbd{S-@key{TAB}} is called with a numeric prefix argument N, the |
751 | CONTENTS view up to headlines of level N will be shown. Note that inside | |
752 | tables, @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 | |
757 | Show all. | |
758 | @kindex C-c C-r | |
759 | @item C-c C-r | |
a7808fba CD |
760 | Reveal context around point, showing the current entry, the following heading |
761 | and the hierarchy above. Useful for working near a location that has been | |
762 | exposed 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 |
764 | level, all sibling headings. |
765 | @kindex C-c C-x b | |
766 | @item C-c C-x b | |
767 | Show the current subtree in an indirect buffer@footnote{The indirect | |
768 | buffer | |
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 | |
775 | will contain the entire buffer, but will be narrowed to the current | |
776 | tree. Editing the indirect buffer will also change the original buffer, | |
a7808fba CD |
777 | but without affecting visibility in that buffer.}. With a numeric |
778 | prefix argument N, go up to level N and then take that tree. If N is | |
779 | negative then go up that many levels. With a @kbd{C-u} prefix, do not remove | |
4009494e GM |
780 | the previously used indirect buffer. |
781 | @end table | |
782 | ||
a7808fba | 783 | When Emacs first visits an Org file, the global state is set to |
4009494e GM |
784 | OVERVIEW, i.e. only the top level headlines are visible. This can be |
785 | configured through the variable @code{org-startup-folded}, or on a | |
786 | per-file basis by adding one of the following lines anywhere in the | |
787 | buffer: | |
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 | |
800 | The 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 | |
805 | Next heading. | |
806 | @kindex C-c C-p | |
807 | @item C-c C-p | |
808 | Previous heading. | |
809 | @kindex C-c C-f | |
810 | @item C-c C-f | |
811 | Next heading same level. | |
812 | @kindex C-c C-b | |
813 | @item C-c C-b | |
814 | Previous heading same level. | |
815 | @kindex C-c C-u | |
816 | @item C-c C-u | |
817 | Backward to higher level heading. | |
818 | @kindex C-c C-j | |
819 | @item C-c C-j | |
820 | Jump to a different place without changing the current outline | |
821 | visibility. Shows the document structure in a temporary buffer, where | |
822 | you 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.} | |
826 | n / p @r{Next/previous visible headline.} | |
827 | f / b @r{Next/previous headline same level.} | |
828 | u @r{One level up.} | |
829 | 0-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} | |
849 | Insert new heading with same level as current. If the cursor is in a | |
850 | plain list item, a new item is created (@pxref{Plain lists}). To force | |
a7808fba | 851 | creation of a new headline, use a prefix argument, or first press @key{RET} |
4009494e GM |
852 | to get to the beginning of the next line. When this command is used in |
853 | the middle of a line, the line is split and the rest of the line becomes | |
28a16a1b CD |
854 | the new headline@footnote{If you do not want the line to be split, |
855 | customize the variable @code{org-M-RET-may-split-line}.}. If the | |
856 | command is used at the beginning of a headline, the new headline is | |
857 | created before the current line. If at the beginning of any other line, | |
858 | the content of that line is made the new heading. If the command is | |
859 | used at the end of a folded subtree (i.e. behind the ellipses at the end | |
860 | of a headline), then a headline like the current one will be inserted | |
861 | after the end of the subtree. | |
dbc28aaa CD |
862 | @kindex C-@key{RET} |
863 | @item C-@key{RET} | |
864 | Insert a new heading after the current subtree, same level as the | |
865 | current headline. This command works from anywhere in the entry. | |
4009494e GM |
866 | @kindex M-S-@key{RET} |
867 | @item M-S-@key{RET} | |
868 | Insert new TODO entry with same level as current heading. | |
869 | @kindex M-@key{left} | |
870 | @item M-@key{left} | |
871 | Promote current heading by one level. | |
872 | @kindex M-@key{right} | |
873 | @item M-@key{right} | |
874 | Demote current heading by one level. | |
875 | @kindex M-S-@key{left} | |
876 | @item M-S-@key{left} | |
877 | Promote the current subtree by one level. | |
878 | @kindex M-S-@key{right} | |
879 | @item M-S-@key{right} | |
880 | Demote the current subtree by one level. | |
881 | @kindex M-S-@key{up} | |
882 | @item M-S-@key{up} | |
883 | Move subtree up (swap with previous subtree of same | |
884 | level). | |
885 | @kindex M-S-@key{down} | |
886 | @item M-S-@key{down} | |
887 | Move 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 | |
892 | Kill subtree, i.e. remove it from buffer but save in kill ring. | |
a7808fba | 893 | With 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 |
896 | Copy subtree to kill ring. With a numeric prefix argument N, copy the N |
897 | sequential subtrees. | |
4009494e GM |
898 | @kindex C-c C-x C-y |
899 | @item C-c C-x C-y | |
900 | Yank subtree from kill ring. This does modify the level of the subtree to | |
a7808fba CD |
901 | make sure the tree fits in nicely at the yank position. The yank level can |
902 | also be specified with a numeric prefix argument, or by yanking after a | |
4009494e | 903 | headline marker like @samp{****}. |
dbc28aaa CD |
904 | @kindex C-c C-w |
905 | @item C-c C-w | |
906 | Refile entry to a different location. @xref{Refiling notes}. | |
4009494e GM |
907 | @kindex C-c ^ |
908 | @item C-c ^ | |
a7808fba CD |
909 | Sort same-level entries. When there is an active region, all entries in the |
910 | region will be sorted. Otherwise the children of the current headline are | |
911 | sorted. The command prompts for the sorting method, which can be | |
912 | alphabetically, numerically, by time (using the first time stamp in each | |
913 | entry), by priority, or by TODO keyword (in the sequence the keywords have | |
914 | been defined in the setup). Reverse sorting is possible as well. You can | |
915 | also supply your own function to extract the sorting key. With a @kbd{C-u} | |
916 | prefix, sorting will be case-sensitive. With two @kbd{C-u C-u} prefixes, | |
917 | duplicate entries will also be removed. | |
28a16a1b CD |
918 | @kindex C-c * |
919 | @item C-c * | |
920 | Turn a normal line or plain list item into a headline (so that it | |
921 | becomes a subheading at its location). Also turn a headline into a | |
922 | normal line by removing the stars. If there is an active region, turn | |
923 | all lines in the region into headlines. Or, if the first line is a | |
924 | headline, 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 |
930 | When there is an active region (Transient mark mode), promotion and | |
4009494e GM |
931 | demotion work on all headlines in the region. To select a region of |
932 | headlines, it is best to place both point and mark at the beginning of a | |
933 | line, mark at the beginning of the first headline, and point at the line | |
934 | just after the last headline to change. Note that when the cursor is | |
935 | inside a table (@pxref{Tables}), the Meta-Cursor keys have different | |
936 | functionality. | |
937 | ||
a7808fba | 938 | @node Archiving, Sparse trees, Structure editing, Document Structure |
4009494e GM |
939 | @section Archiving |
940 | @cindex archiving | |
941 | ||
942 | When a project represented by a (sub)tree is finished, you may want | |
943 | to move the tree out of the way and to stop it from contributing to the | |
a7808fba | 944 | agenda. Org mode knows two ways of archiving. You can mark a tree with |
4009494e GM |
945 | the ARCHIVE tag, or you can move an entire (sub)tree to a different |
946 | location. | |
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 | ||
957 | A headline that is marked with the ARCHIVE tag (@pxref{Tags}) stays at | |
958 | its location in the outline tree, but behaves in the following way: | |
959 | @itemize @minus | |
960 | @item | |
961 | It does not open when you attempt to do so with a visibility cycling | |
962 | command (@pxref{Visibility cycling}). You can force cycling archived | |
963 | subtrees 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 | |
967 | During sparse tree construction (@pxref{Sparse trees}), matches in | |
968 | archived subtrees are not exposed, unless you configure the option | |
969 | @code{org-sparse-tree-open-archived-trees}. | |
970 | @item | |
a7808fba | 971 | During agenda view construction (@pxref{Agenda Views}), the content of |
4009494e GM |
972 | archived trees is ignored unless you configure the option |
973 | @code{org-agenda-skip-archived-trees}. | |
974 | @item | |
975 | Archived trees are not exported (@pxref{Exporting}), only the headline | |
976 | is. Configure the details using the variable | |
977 | @code{org-export-with-archived-trees}. | |
978 | @end itemize | |
979 | ||
980 | The 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 | 985 | Toggle the ARCHIVE tag for the current headline. When the tag is set, |
a7808fba | 986 | the headline changes to a shadowed face, and the subtree below it is |
4009494e | 987 | hidden. |
a7808fba CD |
988 | @kindex C-u C-c C-x a |
989 | @item C-u C-c C-x a | |
4009494e GM |
990 | Check if any direct children of the current headline should be archived. |
991 | To do this, each subtree is checked for open TODO entries. If none are | |
992 | found, the command offers to set the ARCHIVE tag for the child. If the | |
993 | cursor is @emph{not} on a headline when this command is invoked, the | |
994 | level 1 trees will be checked. | |
995 | @kindex C-@kbd{TAB} | |
996 | @item C-@kbd{TAB} | |
997 | Cycle 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 |
1004 | Once an entire project is finished, you may want to move it to a different |
1005 | location. Org can move it to an @emph{Attic Sibling} in the same tree, to a | |
1006 | different 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 | 1011 | Move the current entry to the @emph{Attic Sibling}. This is a sibling of the |
a7808fba CD |
1012 | entry 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 | |
1014 | way retains a lot of its original context, including inherited tags and | |
1015 | approximate position in the outline. | |
4009494e GM |
1016 | @kindex C-c C-x C-s |
1017 | @item C-c C-x C-s | |
1018 | Archive the subtree starting at the cursor position to the location | |
1019 | given by @code{org-archive-location}. Context information that could be | |
a7808fba | 1020 | lost like the file name, the category, inherited tags, and the TODO |
4009494e GM |
1021 | state 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 | |
1024 | Check if any direct children of the current headline could be moved to | |
1025 | the archive. To do this, each subtree is checked for open TODO entries. | |
1026 | If none are found, the command offers to move it to the archive | |
1027 | location. If the cursor is @emph{not} on a headline when this command | |
1028 | is invoked, the level 1 trees will be checked. | |
1029 | @end table | |
1030 | ||
1031 | @cindex archive locations | |
1032 | The default archive location is a file in the same directory as the | |
1033 | current file, with the name derived by appending @file{_archive} to the | |
1034 | current file name. For information and examples on how to change this, | |
1035 | see the documentation string of the variable | |
1036 | @code{org-archive-location}. There is also an in-buffer option for | |
dbc28aaa CD |
1037 | setting this variable, for example@footnote{For backward compatibility, |
1038 | the following also works: If there are several such lines in a file, | |
1039 | each specifies the archive location for the text below it. The first | |
1040 | such line also applies to any text before its definition. However, | |
1041 | using this method is @emph{strongly} deprecated as it is incompatible | |
1042 | with the outline structure of the document. The correct method for | |
1043 | setting 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 |
1050 | If you would like to have a special ARCHIVE location for a single entry |
1051 | or a (sub)tree, give the entry an @code{:ARCHIVE:} property with the | |
a7808fba | 1052 | location as the value (@pxref{Properties and Columns}). |
4009494e | 1053 | |
28a16a1b CD |
1054 | When a subtree is moved, it receives a number of special properties that |
1055 | record context information like the file from where the entry came, it's | |
1056 | outline path the archiving time etc. Configure the variable | |
1057 | @code{org-archive-save-context-info} to adjust the amount of information | |
1058 | added. | |
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 | 1067 | An 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 |
1069 | the entire document is folded as much as possible, but the selected | |
1070 | information is made visible along with the headline structure above | |
1071 | it@footnote{See also the variables @code{org-show-hierarchy-above}, | |
1072 | @code{org-show-following-heading}, and @code{org-show-siblings} for | |
1073 | detailed control on how much context is shown around each match.}. Just | |
1074 | try it out and you will see immediately how it works. | |
1075 | ||
a7808fba | 1076 | Org mode contains several commands creating such trees, all these |
dbc28aaa | 1077 | commands can be accessed through a dispatcher: |
4009494e GM |
1078 | |
1079 | @table @kbd | |
1080 | @kindex C-c / | |
1081 | @item C-c / | |
dbc28aaa CD |
1082 | This prompts for an extra key to select a sparse-tree creating command. |
1083 | @kindex C-c / r | |
1084 | @item C-c / r | |
4009494e GM |
1085 | Occur. Prompts for a regexp and shows a sparse tree with all matches. |
1086 | If the match is in a headline, the headline is made visible. If the | |
1087 | match is in the body of an entry, headline and body are made visible. | |
1088 | In order to provide minimal context, also the full hierarchy of | |
1089 | headlines above the match is shown, as well as the headline following | |
1090 | the match. Each match is also highlighted; the highlights disappear | |
1091 | when 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 | |
1093 | highlights are kept, so several calls to this command can be stacked. | |
1094 | @end table | |
dbc28aaa | 1095 | |
4009494e GM |
1096 | @noindent |
1097 | For frequently used sparse trees of specific search strings, you can | |
1098 | use the variable @code{org-agenda-custom-commands} to define fast | |
1099 | keyboard access to specific sparse trees. These commands will then be | |
1100 | accessible through the agenda dispatcher (@pxref{Agenda dispatcher}). | |
1101 | For 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 | |
1109 | a sparse tree matching the string @samp{FIXME}. | |
1110 | ||
dbc28aaa CD |
1111 | The other sparse tree commands select headings based on TODO keywords, |
1112 | tags, 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 | |
1117 | To print a sparse tree, you can use the Emacs command | |
1118 | @code{ps-print-buffer-with-faces} which does not print invisible parts | |
1119 | of the document @footnote{This does not work under XEmacs, because | |
1120 | XEmacs uses selective display for outlining, not text properties.}. | |
1121 | Or you can use the command @kbd{C-c C-e v} to export only the visible | |
1122 | part 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 | ||
1131 | Within an entry of the outline tree, hand-formatted lists can provide | |
1132 | additional structure. They also provide a way to create lists of | |
a7808fba | 1133 | checkboxes (@pxref{Checkboxes}). Org supports editing such lists, |
dbc28aaa | 1134 | and the HTML exporter (@pxref{Exporting}) parses and formats them. |
4009494e | 1135 | |
a7808fba | 1136 | Org knows ordered and unordered lists. Unordered list items start |
4009494e GM |
1137 | with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a |
1138 | bullet, lines must be indented or they will be seen as top-level | |
1139 | headlines. Also, when you are hiding leading stars to get a clean | |
1140 | outline view, plain list items starting with a star are visually | |
1141 | indistinguishable from true headlines. In short: even though @samp{*} | |
dbc28aaa CD |
1142 | is supported, it may be better to not use it for plain list items.} as |
1143 | bullets. Ordered list items start with a numeral followed by either a | |
1144 | period or a right parenthesis, such as @samp{1.} or @samp{1)}. Items | |
4009494e GM |
1145 | belonging to the same list must have the same indentation on the first |
1146 | line. In particular, if an ordered list reaches number @samp{10.}, then | |
1147 | the 2--digit numbers must be written left-aligned with the other numbers | |
1148 | in the list. Indentation also determines the end of a list item. It | |
1149 | ends before the next line that is indented like the bullet/number, or | |
1150 | less. Empty lines are part of the previous item, so you can have | |
1151 | several paragraphs in one item. If you would like an empty line to | |
1152 | terminate 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 |
1170 | Org supports these lists by tuning filling and wrapping commands to |
1171 | deal with them correctly@footnote{Org only changes the filling | |
4009494e GM |
1172 | settings 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 | |
1176 | The following commands act on items when the cursor is in the first line | |
1177 | of an item (the line with the bullet or number). | |
1178 | ||
1179 | @table @kbd | |
1180 | @kindex @key{TAB} | |
1181 | @item @key{TAB} | |
1182 | Items 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 | |
1184 | given by the indentation of the bullet/number. Items are always | |
1185 | subordinate to real headlines, however; the hierarchies remain | |
1186 | completely separated. | |
1187 | ||
1188 | If @code{org-cycle-include-plain-lists} has not been set, @key{TAB} | |
a7808fba | 1189 | fixes the indentation of the current line in a heuristic way. |
4009494e GM |
1190 | @kindex M-@key{RET} |
1191 | @item M-@key{RET} | |
a7808fba CD |
1192 | Insert new item at current level. With a prefix argument, force a new |
1193 | heading (@pxref{Structure editing}). If this command is used in the middle | |
1194 | of a line, the line is @emph{split} and the rest of the line becomes the new | |
1195 | item@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 | |
1199 | space before the text that is part of an item but does not contain the | |
1200 | bullet, a bullet is added to the current line. | |
4009494e GM |
1201 | @kindex M-S-@key{RET} |
1202 | @item M-S-@key{RET} | |
1203 | Insert 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} | |
1208 | Jump 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} | |
1213 | Move the item including subitems up/down (swap with previous/next item | |
1214 | of same indentation). If the list is ordered, renumbering is | |
1215 | automatic. | |
1216 | @kindex M-S-@key{left} | |
1217 | @kindex M-S-@key{right} | |
1218 | @item M-S-@key{left} | |
1219 | @itemx M-S-@key{right} | |
1220 | Decrease/increase the indentation of the item, including subitems. | |
1221 | Initially, the item tree is selected based on current indentation. | |
1222 | When these commands are executed several times in direct succession, | |
1223 | the initially selected region is used, even if the new indentation | |
1224 | would imply a different hierarchy. To use the new hierarchy, break | |
1225 | the command chain with a cursor motion or so. | |
1226 | @kindex C-c C-c | |
1227 | @item C-c C-c | |
1228 | If there is a checkbox (@pxref{Checkboxes}) in the item line, toggle the | |
dbc28aaa CD |
1229 | state of the checkbox. If not, this command makes sure that all the |
1230 | items on this list level use the same bullet. Furthermore, if this is | |
a7808fba | 1231 | an ordered list, make sure the numbering is OK. |
4009494e GM |
1232 | @kindex C-c - |
1233 | @item C-c - | |
a7808fba CD |
1234 | Cycle the entire list level through the different itemize/enumerate bullets |
1235 | (@samp{-}, @samp{+}, @samp{*}, @samp{1.}, @samp{1)}). With a numeric prefix | |
1236 | argument N, select the Nth bullet from this list. If there is an active | |
1237 | region when calling this, all lines will be converted to list items. If the | |
1238 | first line already was a list item, any item markers will be removed from the | |
1239 | list. Finally, even without an active region, a normal line will be | |
1240 | converted 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 | ||
1248 | Sometimes you want to keep information associated with an entry, but you | |
a7808fba | 1249 | normally don't want to see it. For this, Org mode has @emph{drawers}. |
dbc28aaa CD |
1250 | Drawers need to be configured with the variable |
1251 | @code{org-drawers}@footnote{You can define drawers on a per-file basis | |
1252 | with a line like @code{#+DRAWERS: HIDDEN PROPERTIES STATE}}. Drawers | |
4009494e GM |
1253 | look 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 | ||
1264 | Visibility cycling (@pxref{Visibility cycling}) on the headline will | |
1265 | hide and show the entry, but keep the drawer collapsed to a single line. | |
1266 | In order to look inside the drawer, you need to move the cursor to the | |
a7808fba CD |
1267 | drawer line and press @key{TAB} there. Org mode uses a drawer for |
1268 | storing 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 | 1275 | If you like the intuitive way the Org mode structure editing and list |
4009494e | 1276 | formatting works, you might want to use these commands in other modes |
a7808fba | 1277 | like Text mode or Mail mode as well. The minor mode Orgstruct mode |
4009494e | 1278 | makes this possible. You can always toggle the mode with @kbd{M-x |
a7808fba | 1279 | orgstruct-mode}. To turn it on by default, for example in Mail mode, |
4009494e GM |
1280 | use |
1281 | ||
1282 | @lisp | |
1283 | (add-hook 'mail-mode-hook 'turn-on-orgstruct) | |
1284 | @end lisp | |
1285 | ||
1286 | When this mode is active and the cursor is on a line that looks to | |
a7808fba | 1287 | Org like a headline of the first line of a list item, most |
4009494e GM |
1288 | structure editing commands will work, even if the same keys normally |
1289 | have different functionality in the major mode you are using. If the | |
a7808fba | 1290 | cursor is not in one of those special lines, Orgstruct mode lurks |
4009494e GM |
1291 | silently 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 | 1298 | Org comes with a fast and intuitive table editor. Spreadsheet-like |
dbc28aaa | 1299 | calculations are supported in connection with the Emacs @file{calc} |
28a16a1b | 1300 | package |
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 | |
1306 | calculator). | |
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 | 1321 | Org 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 |
1323 | table. @samp{|} is also the column separator. A table might look like | |
1324 | this: | |
1325 | ||
1326 | @example | |
1327 | | Name | Phone | Age | | |
1328 | |-------+-------+-----| | |
1329 | | Peter | 1234 | 17 | | |
1330 | | Anna | 4321 | 25 | | |
1331 | @end example | |
1332 | ||
1333 | A 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 | |
1335 | the next field (@key{RET} to the next row) and creates new table rows | |
1336 | at the end of the table or before horizontal lines. The indentation | |
1337 | of the table is set by the first line. Any line starting with | |
1338 | @samp{|-} is considered as a horizontal separator line and will be | |
1339 | expanded on the next re-align to span the whole table width. So, to | |
1340 | create 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 | |
1348 | fields. | |
1349 | ||
a7808fba | 1350 | When typing text into a field, Org treats @key{DEL}, |
4009494e GM |
1351 | @key{Backspace}, and all character keys in a special way, so that |
1352 | inserting and deleting avoids shifting other fields. Also, when | |
1353 | typing @emph{immediately after the cursor was moved into a new field | |
1354 | with @kbd{@key{TAB}}, @kbd{S-@key{TAB}} or @kbd{@key{RET}}}, the | |
1355 | field is automatically made blank. If this behavior is too | |
1356 | unpredictable 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 | | |
1363 | Convert the active region to table. If every line contains at least one | |
1364 | TAB character, the function assumes that the material is tab separated. | |
dbc28aaa | 1365 | If every line contains a comma, comma-separated values (CSV) are assumed. |
4009494e | 1366 | If not, lines are split at whitespace into fields. You can use a prefix |
dbc28aaa CD |
1367 | argument to force a specific separator: @kbd{C-u} forces CSV, @kbd{C-u |
1368 | C-u} forces TAB, and a numeric argument N indicates that at least N | |
a7808fba | 1369 | consecutive spaces, or alternatively a TAB will be the separator. |
28a16a1b | 1370 | @* |
a7808fba | 1371 | If there is no active region, this command creates an empty Org |
4009494e GM |
1372 | table. 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 | |
1378 | Re-align the table without moving the cursor. | |
1379 | @c | |
1380 | @kindex @key{TAB} | |
1381 | @item @key{TAB} | |
1382 | Re-align the table, move to the next field. Creates a new row if | |
1383 | necessary. | |
1384 | @c | |
1385 | @kindex S-@key{TAB} | |
1386 | @item S-@key{TAB} | |
1387 | Re-align, move to previous field. | |
1388 | @c | |
1389 | @kindex @key{RET} | |
1390 | @item @key{RET} | |
1391 | Re-align the table and move down to next row. Creates a new row if | |
1392 | necessary. At the beginning or end of a line, @key{RET} still does | |
1393 | NEWLINE, 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} | |
1400 | Move the current column left/right. | |
1401 | @c | |
1402 | @kindex M-S-@key{left} | |
1403 | @item M-S-@key{left} | |
1404 | Kill the current column. | |
1405 | @c | |
1406 | @kindex M-S-@key{right} | |
1407 | @item M-S-@key{right} | |
1408 | Insert 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} | |
1414 | Move the current row up/down. | |
1415 | @c | |
1416 | @kindex M-S-@key{up} | |
1417 | @item M-S-@key{up} | |
1418 | Kill the current row or horizontal line. | |
1419 | @c | |
1420 | @kindex M-S-@key{down} | |
1421 | @item M-S-@key{down} | |
a7808fba CD |
1422 | Insert a new row above the current row. With a prefix argument, the line is |
1423 | created below the current one. | |
4009494e GM |
1424 | @c |
1425 | @kindex C-c - | |
1426 | @item C-c - | |
a7808fba | 1427 | Insert a horizontal line below current row. With a prefix argument, the line |
4009494e GM |
1428 | is created above the current line. |
1429 | @c | |
1430 | @kindex C-c ^ | |
1431 | @item C-c ^ | |
1432 | Sort the table lines in the region. The position of point indicates the | |
1433 | column to be used for sorting, and the range of lines is the range | |
1434 | between the nearest horizontal separator lines, or the entire table. If | |
1435 | point is before the first column, you will be prompted for the sorting | |
1436 | column. If there is an active region, the mark specifies the first line | |
1437 | and the sorting column, while point should be in the last line to be | |
1438 | included into the sorting. The command prompts for the sorting type | |
1439 | (alphabetically, numerically, or by time). When called with a prefix | |
1440 | argument, 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 | |
1445 | Copy a rectangular region from a table to a special clipboard. Point | |
1446 | and mark determine edge fields of the rectangle. The process ignores | |
1447 | horizontal separator lines. | |
1448 | @c | |
1449 | @kindex C-c C-x C-w | |
1450 | @item C-c C-x C-w | |
1451 | Copy a rectangular region from a table to a special clipboard, and | |
1452 | blank 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 | |
1456 | Paste a rectangular region into a table. | |
1457 | The upper right corner ends up in the current field. All involved fields | |
1458 | will be overwritten. If the rectangle does not fit into the present table, | |
1459 | the table is enlarged as needed. The process ignores horizontal separator | |
1460 | lines. | |
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 |
1466 | Wrap several fields in a column like a paragraph. If there is an active |
1467 | region, and both point and mark are in the same column, the text in the | |
a7808fba CD |
1468 | column is wrapped to minimum width for the given number of lines. A numeric |
1469 | prefix argument may be used to change the number of desired lines. If there | |
1470 | is no region, the current field is split at the cursor position and the text | |
1471 | fragment to the right of the cursor is prepended to the field one line | |
1472 | down. If there is no region, but you specify a prefix argument, the current | |
1473 | field 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 + | |
1483 | Sum the numbers in the current column, or in the rectangle defined by | |
1484 | the active region. The result is shown in the echo area and can | |
1485 | be inserted with @kbd{C-y}. | |
1486 | @c | |
1487 | @kindex S-@key{RET} | |
1488 | @item S-@key{RET} | |
1489 | When current field is empty, copy from first non-empty field above. | |
1490 | When not empty, copy current field down to next row and move cursor | |
1491 | along with it. Depending on the variable | |
1492 | @code{org-table-copy-increment}, integer field values will be | |
a7808fba | 1493 | incremented 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 ` | |
1499 | Edit the current field in a separate window. This is useful for fields | |
1500 | that 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 | |
1502 | edited in place. | |
1503 | @c | |
4009494e GM |
1504 | @item M-x org-table-import |
1505 | Import a file as a table. The table should be TAB- or whitespace | |
dbc28aaa CD |
1506 | separated. Useful, for example, to import a spreadsheet table or data |
1507 | from a database, because these programs generally can write | |
1508 | TAB-separated text files. This command works by inserting the file into | |
1509 | the buffer and then converting the region to a table. Any prefix | |
1510 | argument is passed on to the converter, which uses it to determine the | |
1511 | separator. | |
4009494e | 1512 | @item C-c | |
a7808fba | 1513 | Tables can also be imported by pasting tabular text into the Org |
4009494e GM |
1514 | buffer, 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 |
1518 | Export the table, by default as a TAB-separated file. Useful for data |
1519 | exchange with, for example, spreadsheet or database programs. The format | |
1520 | used 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 | |
1523 | name and the format for table export in a subtree. | |
4009494e GM |
1524 | @end table |
1525 | ||
1526 | If you don't like the automatic table editor because it gets in your | |
1527 | way on lines which you would like to start with @samp{|}, you can turn | |
1528 | it 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 | ||
1541 | The width of columns is automatically determined by the table editor. | |
1542 | Sometimes a single field or a few fields need to carry more text, | |
1543 | leading to inconveniently wide columns. To limit@footnote{This feature | |
1544 | does not work on XEmacs.} the width of a column, one field anywhere in | |
1545 | the column may contain just the string @samp{<N>} where @samp{N} is an | |
1546 | integer specifying the width of the column in characters. The next | |
1547 | re-align will then set the width of this column to no more than this | |
1548 | value. | |
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 | |
1563 | Fields that are wider become clipped and end in the string @samp{=>}. | |
1564 | Note that the full text is still in the buffer, it is only invisible. | |
1565 | To see the full text, hold the mouse over the field - a tool-tip window | |
1566 | will 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 | |
1568 | open a new window with the full field. Edit it and finish with @kbd{C-c | |
1569 | C-c}. | |
1570 | ||
1571 | When visiting a file containing a table with narrowed columns, the | |
1572 | necessary character hiding has not yet happened, and the table needs to | |
1573 | be aligned before it looks nice. Setting the option | |
1574 | @code{org-startup-align-all-tables} will realign all tables in a file | |
1575 | upon visiting, but also slow down startup. You can also set this option | |
1576 | on 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 | 1587 | When Org exports tables, it does so by default without vertical |
4009494e GM |
1588 | lines because that is visually more satisfying in general. Occasionally |
1589 | however, vertical lines can be useful to structure a table into groups | |
1590 | of columns, much like horizontal lines can do for groups of rows. In | |
1591 | order to specify column groups, you can use a special row where the | |
1592 | first field contains only @samp{/}. The further fields can either | |
1593 | contain @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 | 1595 | a group of its own. Boundaries between column groups will upon export be |
4009494e GM |
1596 | marked 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 | 1609 | It is also sufficient to just insert the column group starters after |
4009494e GM |
1610 | every 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 |
1623 | If you like the intuitive way the Org table editor works, you |
1624 | might also want to use it in other modes like Text mode or Mail mode. | |
1625 | The minor mode Orgtbl mode makes this possible. You can always toggle | |
4009494e GM |
1626 | the mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for |
1627 | example in mail mode, use | |
1628 | ||
1629 | @lisp | |
1630 | (add-hook 'mail-mode-hook 'turn-on-orgtbl) | |
1631 | @end lisp | |
1632 | ||
1633 | Furthermore, with some special setup, it is possible to maintain tables | |
a7808fba | 1634 | in arbitrary syntax with Orgtbl mode. For example, it is possible to |
4009494e | 1635 | construct La@TeX{} tables with the underlying ease and power of |
a7808fba | 1636 | Orgtbl 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 | ||
1645 | The table editor makes use of the Emacs @file{calc} package to implement | |
1646 | spreadsheet-like capabilities. It can also evaluate Emacs Lisp forms to | |
a7808fba | 1647 | derive fields from other fields. While fully featured, Org's |
4009494e | 1648 | implementation is not identical to other spreadsheets. For example, |
a7808fba | 1649 | Org knows the concept of a @emph{column formula} that will be |
4009494e GM |
1650 | applied to all non-header fields in a column without having to copy the |
1651 | formula 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 | ||
1668 | To compute fields in the table from other fields, formulas must | |
a7808fba | 1669 | reference other fields or ranges. In Org, fields can be referenced |
4009494e GM |
1670 | by name, by absolute coordinates, and by relative coordinates. To find |
1671 | out what the coordinates of a field are, press @kbd{C-c ?} in that | |
1672 | field, 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 | ||
1678 | Formulas can reference the value of another field in two ways. Like in | |
1679 | any other spreadsheet, you may reference fields with a letter/number | |
1680 | combination 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 | 1686 | Org also uses another, more general operator that looks like this: |
4009494e GM |
1687 | @example |
1688 | @@row$column | |
1689 | @end example | |
1690 | ||
1691 | @noindent | |
1692 | Column references can be absolute like @samp{1}, @samp{2},...@samp{N}, | |
1693 | or relative to the current column like @samp{+1} or @samp{-2}. | |
1694 | ||
1695 | The row specification only counts data lines and ignores horizontal | |
1696 | separator 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 |
1699 | hlines: @samp{I} refers to the first hline@footnote{Note that only |
1700 | hlines are counted that @emph{separate} table lines. If the table | |
1701 | starts with a hline above the header, it does not count.}, @samp{II} to | |
1702 | the second etc. @samp{-I} refers to the first such line above the | |
1703 | current line, @samp{+I} to the first such line below the current line. | |
1704 | You can also write @samp{III+2} which is the second data line after the | |
1705 | third hline in the table. Relative row numbers like @samp{-3} will not | |
1706 | cross hlines if the current line is too close to the hline. Instead, | |
1707 | the value directly at the hline is used. | |
4009494e GM |
1708 | |
1709 | @samp{0} refers to the current row and column. Also, if you omit | |
1710 | either the column or the row part of the reference, the current | |
28a16a1b | 1711 | row/column is implied. |
4009494e | 1712 | |
a7808fba | 1713 | Org's references with @emph{unsigned} numbers are fixed references |
4009494e GM |
1714 | in the sense that if you use the same reference in the formula for two |
1715 | different fields, the same field will be referenced each time. | |
a7808fba | 1716 | Org's references with @emph{signed} numbers are floating |
4009494e GM |
1717 | references because the same reference operator can reference different |
1718 | fields depending on the field being calculated by the formula. | |
1719 | ||
1720 | Here are a few examples: | |
1721 | ||
1722 | @example | |
1723 | @@2$3 @r{2nd row, 3rd column} | |
1724 | C2 @r{same as previous} | |
1725 | $5 @r{column 5 in the current row} | |
1726 | E& @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 | ||
1736 | You may reference a rectangular range of fields by specifying two field | |
1737 | references connected by two dots @samp{..}. If both fields are in the | |
1738 | current row, you may simply use @samp{$2..$7}, but if at least one field | |
1739 | is in a different row, you need to use the general @code{@@row$column} | |
1740 | format 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.} | |
1747 | A2..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 | |
1752 | into Calc vector functions. Empty fields in ranges are normally | |
1753 | suppressed, so that the vector contains only the non-empty fields (but | |
1754 | see 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 | |
1764 | constant. Constants are defined globally through the variable | |
1765 | @code{org-table-formula-constants}, and locally (for the file) through a | |
1766 | line like | |
1767 | ||
1768 | @example | |
1769 | #+CONSTANTS: c=299792458. pi=3.14 eps=2.4e-6 | |
1770 | @end example | |
1771 | ||
1772 | @noindent | |
a7808fba | 1773 | Also properties (@pxref{Properties and Columns}) can be used as |
dbc28aaa CD |
1774 | constants 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 |
1776 | outline entry and in the hierarchy above it. If you have the |
1777 | @file{constants.el} package, it will also be used to resolve constants, | |
1778 | including natural constants like @samp{$h} for Planck's constant, and | |
1779 | units like @samp{$km} for kilometers@footnote{@file{Constant.el} can | |
1780 | supply the values of constants in two different unit systems, @code{SI} | |
1781 | and @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 | |
1784 | buffer.}. Column names and parameters can be specified in special table | |
1785 | lines. These are described below, see @ref{Advanced features}. All | |
1786 | names must start with a letter, and further consist of letters and | |
1787 | numbers. | |
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 | ||
1794 | A formula can be any algebraic expression understood by the Emacs | |
1795 | @file{Calc} package. @b{Note that @file{calc} has the | |
1796 | non-standard convention that @samp{/} has lower precedence than | |
1797 | @samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}.} Before | |
1798 | evaluation by @code{calc-eval} (@pxref{Calling Calc from | |
a7808fba | 1799 | Your Programs,calc-eval,Calling Calc from Your Lisp Programs,Calc,GNU |
4009494e | 1800 | Emacs Calc Manual}), |
a7808fba | 1801 | @c FIXME: The link to the Calc manual in HTML does not work. |
4009494e GM |
1802 | variable substitution takes place according to the rules described above. |
1803 | @cindex vectors, in table calculations | |
a7808fba | 1804 | The range vectors can be directly fed into the Calc vector functions |
4009494e GM |
1805 | like @samp{vmean} and @samp{vsum}. |
1806 | ||
1807 | @cindex format specifier | |
1808 | @cindex mode, for @file{calc} | |
1809 | A formula can contain an optional mode string after a semicolon. This | |
1810 | string consists of flags to influence Calc and other modes during | |
a7808fba | 1811 | execution. By default, Org uses the standard Calc modes (precision |
4009494e GM |
1812 | 12, angular units degrees, fraction and symbolic modes off. The display |
1813 | format, however, has been changed to @code{(float 5)} to keep tables | |
1814 | compact. The default settings can be configured using the variable | |
1815 | @code{org-calc-default-modes}. | |
1816 | ||
1817 | @example | |
1818 | p20 @r{switch the internal precision to 20 digits} | |
1819 | n3 s3 e2 f4 @r{normal, scientific, engineering, or fixed display format} | |
1820 | D R @r{angle modes: degrees, radians} | |
1821 | F S @r{fraction and symbolic modes} | |
1822 | N @r{interpret all fields as numbers, use 0 for non-numbers} | |
1823 | T @r{force text interpretation} | |
1824 | E @r{keep empty fields in ranges} | |
1825 | @end example | |
1826 | ||
1827 | @noindent | |
1828 | In addition, you may provide a @code{printf} format specifier to | |
1829 | reformat 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} | |
1834 | exp($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}} | |
1838 | tan($1);Dp3s1 @r{Compute in degrees, precision 3, display SCI 1} | |
1839 | sin($1);Dp3%.1e @r{Same, but use printf specifier for display} | |
1840 | vmean($2..$7) @r{Compute column range mean, using vector function} | |
1841 | vmean($2..$7);EN @r{Same, but treat empty fields as 0} | |
1842 | taylor($3,x=7,2) @r{taylor series of $3, at x=7, second degree} | |
1843 | @end example | |
1844 | ||
1845 | Calc also contains a complete set of logical operations. For example | |
1846 | ||
1847 | @example | |
1848 | if($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 | ||
1855 | It is also possible to write a formula in Emacs Lisp; this can be useful | |
1856 | for string manipulation and control structures, if the Calc's | |
1857 | functionality is not enough. If a formula starts with a single quote | |
1858 | followed by an opening parenthesis, then it is evaluated as a lisp form. | |
1859 | The 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 | 1861 | semicolon. With Emacs Lisp forms, you need to be conscious about the way |
4009494e GM |
1862 | field references are interpolated into the form. By default, a |
1863 | reference will be interpolated as a Lisp string (in double quotes) | |
1864 | containing the field. If you provide the @samp{N} mode switch, all | |
1865 | referenced elements will be numbers (non-number fields will be zero) and | |
1866 | interpolated as Lisp numbers, without quotes. If you provide the | |
1867 | @samp{L} flag, all fields will be interpolated literally, without quotes. | |
1868 | I.e., if you want a reference to be interpreted as a string by the Lisp | |
a7808fba | 1869 | form, enclose the reference operator itself in double quotes, like |
4009494e GM |
1870 | @code{"$3"}. Ranges are inserted as space-separated fields, so you can |
1871 | embed 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 | ||
1888 | To assign a formula to a particular field, type it directly into the | |
1889 | field, preceded by @samp{:=}, for example @samp{:=$1+$2}. When you | |
1890 | press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in | |
1891 | the field, the formula will be stored as the formula for this field, | |
1892 | evaluated, and the current field replaced with the result. | |
1893 | ||
1894 | Formulas are stored in a special line starting with @samp{#+TBLFM:} | |
1895 | directly below the table. If you typed the equation in the 4th field of | |
1896 | the 3rd data line in the table, the formula will look like | |
1897 | @samp{@@3$4=$1+$2}. When inserting/deleting/swapping column and rows | |
1898 | with the appropriate commands, @i{absolute references} (but not relative | |
1899 | ones) in stored formulas are modified in order to still reference the | |
1900 | same field. Of cause this is not true if you edit the table structure | |
1901 | with normal editing commands - then you must fix the equations yourself. | |
1902 | ||
1903 | Instead of typing an equation into the field, you may also use the | |
1904 | following command | |
1905 | ||
1906 | @table @kbd | |
1907 | @kindex C-u C-c = | |
1908 | @item C-u C-c = | |
1909 | Install a new formula for the current field. The command prompts for a | |
1910 | formula, with default taken from the @samp{#+TBLFM:} line, applies | |
1911 | it 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 | ||
1919 | Often in a table, the same formula should be used for all fields in a | |
1920 | particular column. Instead of having to copy the formula to all fields | |
a7808fba | 1921 | in that column, Org allows to assign a single formula to an entire |
4009494e GM |
1922 | column. If the table contains horizontal separator hlines, everything |
1923 | before the first such line is considered part of the table @emph{header} | |
1924 | and will not be modified by column formulas. | |
1925 | ||
1926 | To assign a formula to a column, type it directly into any field in the | |
1927 | column, 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 | |
1929 | field, the formula will be stored as the formula for the current column, | |
1930 | evaluated and the current field replaced with the result. If the field | |
1931 | contains only @samp{=}, the previously stored formula for this column is | |
a7808fba | 1932 | used. For each column, Org will only remember the most recently |
4009494e GM |
1933 | used formula. In the @samp{TBLFM:} line, column formulas will look like |
1934 | @samp{$4=$1+$2}. | |
1935 | ||
1936 | Instead of typing an equation into the field, you may also use the | |
1937 | following command: | |
1938 | ||
1939 | @table @kbd | |
1940 | @kindex C-c = | |
1941 | @item C-c = | |
a7808fba CD |
1942 | Install a new formula for the current column and replace current field with |
1943 | the result of the formula. The command prompts for a formula, with default | |
1944 | taken from the @samp{#+TBLFM} line, applies it to the current field and | |
1945 | stores it. With a numeric prefix argument(e.g. @kbd{C-5 C-c =}) the command | |
4009494e GM |
1946 | will 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 | ||
1954 | You can edit individual formulas in the minibuffer or directly in the | |
a7808fba CD |
1955 | field. Org can also prepare a special buffer with all active |
1956 | formulas of a table. When offering a formula for editing, Org | |
4009494e GM |
1957 | converts references to the standard format (like @code{B3} or @code{D&}) |
1958 | if 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 = | |
1967 | Edit the formula associated with the current column/field in the | |
1968 | minibuffer. See @ref{Column formulas} and @ref{Field formulas}. | |
1969 | @kindex C-u C-u C-c = | |
1970 | @item C-u C-u C-c = | |
1971 | Re-insert the active formula (either a | |
1972 | field formula, or a column formula) into the current field, so that you | |
1973 | can edit it directly in the field. The advantage over editing in the | |
1974 | minibuffer is that you can use the command @kbd{C-c ?}. | |
1975 | @kindex C-c ? | |
1976 | @item C-c ? | |
1977 | While editing a formula in a table field, highlight the field(s) | |
1978 | referenced by the reference at the cursor position in the formula. | |
1979 | @kindex C-c @} | |
1980 | @item C-c @} | |
1981 | Toggle the display of row and column numbers for a table, using | |
1982 | overlays. These are updated each time the table is aligned, you can | |
1983 | force it with @kbd{C-c C-c}. | |
1984 | @kindex C-c @{ | |
1985 | @item C-c @{ | |
1986 | Toggle the formula debugger on and off. See below. | |
1987 | @kindex C-c ' | |
1988 | @item C-c ' | |
1989 | Edit all formulas for the current table in a special buffer, where the | |
1990 | formulas will be displayed one per line. If the current field has an | |
1991 | active formula, the cursor in the formula editor will mark it. | |
a7808fba | 1992 | While inside the special buffer, Org will automatically highlight |
4009494e GM |
1993 | any field or range reference at the cursor position. You may edit, |
1994 | remove 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 | |
2000 | Exit the formula editor and store the modified formulas. With @kbd{C-u} | |
2001 | prefix, also apply the new formulas to the entire table. | |
2002 | @kindex C-c C-q | |
2003 | @item C-c C-q | |
2004 | Exit the formula editor without installing changes. | |
2005 | @kindex C-c C-r | |
2006 | @item C-c C-r | |
2007 | Toggle 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} | |
2011 | Pretty-print or indent lisp formula at point. When in a line containing | |
2012 | a lisp formula, format the formula according to Emacs Lisp rules. | |
2013 | Another @key{TAB} collapses the formula back again. In the open | |
a7808fba | 2014 | formula, @key{TAB} re-indents just like in Emacs lisp mode. |
4009494e GM |
2015 | @kindex M-@key{TAB} |
2016 | @item M-@key{TAB} | |
a7808fba | 2017 | Complete 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} | |
2023 | Shift 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}. | |
2025 | This 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 | 2029 | Move the test line for column formulas in the Org buffer up and |
4009494e GM |
2030 | down. |
2031 | @kindex M-@key{up} | |
2032 | @kindex M-@key{down} | |
2033 | @item M-@key{up}/@key{down} | |
2034 | Scroll the window displaying the table. | |
2035 | @kindex C-c @} | |
2036 | @item C-c @} | |
2037 | Turn the coordinate grid in the table on and off. | |
2038 | @end table | |
2039 | @end table | |
2040 | ||
2041 | Making a table field blank does not remove the formula associated with | |
2042 | the field, because that is stored in a different line (the @samp{TBLFM} | |
2043 | line) - during the next recalculation the field will be filled again. | |
2044 | To remove a formula from a field, you have to give an empty reply when | |
2045 | prompted for the formula, or to edit the @samp{#+TBLFM} line. | |
2046 | ||
2047 | @kindex C-c C-c | |
2048 | You may edit the @samp{#+TBLFM} directly and re-apply the changed | |
2049 | equations with @kbd{C-c C-c} in that line, or with the normal | |
2050 | recalculation commands in the table. | |
2051 | ||
2052 | @subsubheading Debugging formulas | |
2053 | @cindex formula debugging | |
2054 | @cindex debugging, of table formulas | |
2055 | When the evaluation of a formula leads to an error, the field content | |
2056 | becomes the string @samp{#ERROR}. If you would like see what is going | |
2057 | on during variable substitution and calculation in order to find a bug, | |
2058 | turn on formula debugging in the @code{Tbl} menu and repeat the | |
2059 | calculation, for example by pressing @kbd{C-u C-u C-c = @key{RET}} in a | |
2060 | field. 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 | ||
2067 | Recalculation of a table is normally not automatic, but needs to be | |
2068 | triggered by a command. See @ref{Advanced features} for a way to make | |
2069 | recalculation at least semi-automatically. | |
2070 | ||
2071 | In order to recalculate a line of a table or the entire table, use the | |
2072 | following commands: | |
2073 | ||
2074 | @table @kbd | |
2075 | @kindex C-c * | |
2076 | @item C-c * | |
2077 | Recalculate the current row by first applying the stored column formulas | |
2078 | from 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 | |
2084 | Recompute the entire table, line by line. Any lines before the first | |
2085 | hline 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 | |
2091 | Iterate the table by recomputing it until no further changes occur. | |
2092 | This may be necessary if some computed fields use the value of other | |
2093 | fields 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 | ||
2099 | If you want the recalculation of fields to happen automatically, or if | |
2100 | you want to be able to assign @i{names} to fields and columns, you need | |
2101 | to reserve the first column of the table for special marking characters. | |
2102 | @table @kbd | |
2103 | @kindex C-# | |
2104 | @item C-# | |
2105 | Rotate the calculation mark in first column through the states @samp{}, | |
2106 | @samp{#}, @samp{*}, @samp{!}, @samp{$}. The meaning of these characters | |
2107 | is discussed below. When there is an active region, change all marks in | |
2108 | the region. | |
2109 | @end table | |
2110 | ||
2111 | Here is an example of a table that collects exam results of students and | |
2112 | makes 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, | |
2136 | recalculating the table with @kbd{C-u C-c *} will only affect rows that | |
2137 | are marked @samp{#} or @samp{*}, and fields that have a formula assigned | |
2138 | to the field itself. The column formulas are not applied in rows with | |
2139 | empty first field. | |
2140 | ||
2141 | @cindex marking characters, tables | |
2142 | The marking characters have the following meaning: | |
2143 | @table @samp | |
2144 | @item ! | |
2145 | The fields in this line define names for the columns, so that you may | |
2146 | refer to a column as @samp{$Tot} instead of @samp{$6}. | |
2147 | @item ^ | |
2148 | This row defines names for the fields @emph{above} the row. With such | |
2149 | a definition, any formula in the table may use @samp{$m1} to refer to | |
2150 | the value @samp{10}. Also, if you assign a formula to a names field, it | |
2151 | will be stored as @samp{$name=...}. | |
2152 | @item _ | |
2153 | Similar to @samp{^}, but defines names for the fields in the row | |
2154 | @emph{below}. | |
2155 | @item $ | |
2156 | Fields in this row can define @emph{parameters} for formulas. For | |
2157 | example, if a field in a @samp{$} row contains @samp{max=50}, then | |
2158 | formulas in this table can refer to the value 50 using @samp{$max}. | |
2159 | Parameters work exactly like constants, only that they can be defined on | |
2160 | a per-table basis. | |
2161 | @item # | |
2162 | Fields 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 | |
2164 | is selected for a global recalculation with @kbd{C-u C-c *}. Unmarked | |
2165 | lines will be left alone by this command. | |
2166 | @item * | |
2167 | Selects this line for global recalculation with @kbd{C-u C-c *}, but | |
2168 | not for automatic recalculation. Use this when automatic | |
2169 | recalculation slows down editing too much. | |
2170 | @item | |
2171 | Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}. | |
2172 | All lines that should be recalculated should be marked with @samp{#} | |
2173 | or @samp{*}. | |
2174 | @item / | |
2175 | Do not export this line. Useful for lines that contain the narrowing | |
2176 | @samp{<N>} markers. | |
2177 | @end table | |
2178 | ||
2179 | Finally, just to whet your appetite on what can be done with the | |
2180 | fantastic @file{calc} package, here is a table that computes the Taylor | |
28a16a1b CD |
2181 | series of degree @code{n} at location @code{x} for a couple of |
2182 | functions. | |
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 | 2204 | Like HTML, Org provides links inside a file, external links to |
dbc28aaa | 2205 | other 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 | 2223 | Org will recognize plain URL-like links and activate them as |
4009494e GM |
2224 | clickable 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 | 2230 | Once a link in the buffer is complete (all brackets present), Org |
4009494e GM |
2231 | will change the display so that @samp{description} is displayed instead |
2232 | of @samp{[[link][description]]} and @samp{link} is displayed instead of | |
2233 | @samp{[[link]]}. Links will be highlighted in the face @code{org-link}, | |
2234 | which by default is an underlined face. You can directly edit the | |
2235 | visible part of a link. Note that this can be either the @samp{link} | |
2236 | part (if there is no description) or the @samp{description} part. To | |
2237 | edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the | |
2238 | cursor on the link. | |
2239 | ||
2240 | If you place the cursor at the beginning or just behind the end of the | |
2241 | displayed text and press @key{BACKSPACE}, you will remove the | |
2242 | (invisible) bracket at that location. This makes the link incomplete | |
2243 | and the internals are again displayed as plain text. Inserting the | |
2244 | missing bracket hides the link internals again. To show the | |
2245 | internal 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 | ||
2254 | If the link does not look like a URL, it is considered to be internal in | |
2255 | the current file. Links such as @samp{[[My Target]]} or @samp{[[My | |
2256 | Target][Find my target]]} lead to a text search in the current file. | |
2257 | The link can be followed with @kbd{C-c C-o} when the cursor is on the | |
2258 | link, or with a mouse click (@pxref{Handling links}). The preferred | |
2259 | match for such a link is a dedicated target: the same string in double | |
2260 | angular brackets. Targets may be located anywhere; sometimes it is | |
2261 | convenient 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 | |
2268 | named anchors for direct access through @samp{http} links@footnote{Note | |
2269 | that text before the first headline is usually not exported, so the | |
2270 | first such target should be after the first headline.}. | |
2271 | ||
a7808fba | 2272 | If no dedicated target exists, Org will search for the words in the |
4009494e GM |
2273 | link. In the above example the search would be for @samp{my target}. |
2274 | Links starting with a star like @samp{*My Target} restrict the search to | |
a7808fba | 2275 | headlines. When searching, Org mode will first try an exact match, but |
4009494e GM |
2276 | then 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 | ||
2285 | To insert a link targeting a headline, in-buffer completion can be used. | |
2286 | Just type a star followed by a few optional letters into the buffer and | |
2287 | press @kbd{M-@key{TAB}}. All headlines in the current buffer will be | |
2288 | offered as completions. @xref{Handling links}, for more commands | |
2289 | creating links. | |
2290 | ||
a7808fba | 2291 | Following a link pushes a mark onto Org's own mark ring. You can |
4009494e GM |
2292 | return to the previous position with @kbd{C-c &}. Using this command |
2293 | several times in direct succession goes back to positions recorded | |
2294 | earlier. | |
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 | 2306 | Org can automatically turn any occurrences of certain target names |
4009494e GM |
2307 | in normal text into a link. So without explicitly creating a link, the |
2308 | text connects to the target radioing its position. Radio targets are | |
2309 | enclosed by triple angular brackets. For example, a target @samp{<<<My | |
2310 | Target>>>} causes each occurrence of @samp{my target} in normal text to | |
a7808fba | 2311 | become activated as a link. The Org file is scanned automatically |
4009494e GM |
2312 | for radio targets only when the file is first loaded into Emacs. To |
2313 | update the target list during editing, press @kbd{C-c C-c} with the | |
2314 | cursor 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 | 2335 | Org supports links to files, websites, Usenet and email messages, |
28a16a1b CD |
2336 | BBDB database entries and links to both IRC conversations and their |
2337 | logs. External links are URL-like locators. They start with a short | |
2338 | identifying string followed by a colon. There can be no space after | |
2339 | the colon. The following list shows examples for each link type. | |
4009494e GM |
2340 | |
2341 | @example | |
a7808fba | 2342 | http://www.astro.uva.nl/~dominik @r{on the web} |
4009494e GM |
2343 | file:/home/dominik/images/jupiter.jpg @r{file, absolute path} |
2344 | file:papers/last.pdf @r{file, relative path} | |
2345 | news:comp.emacs @r{Usenet link} | |
28a16a1b | 2346 | mailto:adent@@galaxy.net @r{Mail link} |
4009494e GM |
2347 | vm:folder @r{VM folder link} |
2348 | vm:folder#id @r{VM message link} | |
28a16a1b | 2349 | vm://myself@@some.where.org/folder#id @r{VM on remote machine} |
4009494e GM |
2350 | wl:folder @r{WANDERLUST folder link} |
2351 | wl:folder#id @r{WANDERLUST message link} | |
2352 | mhe:folder @r{MH-E folder link} | |
2353 | mhe:folder#id @r{MH-E message link} | |
2354 | rmail:folder @r{RMAIL folder link} | |
2355 | rmail:folder#id @r{RMAIL message link} | |
a7808fba CD |
2356 | gnus:group @r{Gnus group link} |
2357 | gnus:group#id @r{Gnus article link} | |
4009494e | 2358 | bbdb:Richard Stallman @r{BBDB link} |
28a16a1b | 2359 | irc:/irc.com/#emacs/bob @r{IRC link} |
4009494e GM |
2360 | shell:ls *.org @r{A shell command} |
2361 | elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate} | |
2362 | @end example | |
2363 | ||
2364 | A link should be enclosed in double brackets and may contain a | |
a7808fba | 2365 | descriptive text to be displayed instead of the URL (@pxref{Link |
4009494e GM |
2366 | format}), for example: |
2367 | ||
2368 | @example | |
2369 | [[http://www.gnu.org/software/emacs/][GNU Emacs]] | |
2370 | @end example | |
2371 | ||
2372 | @noindent | |
2373 | If the description is a file name or URL that points to an image, HTML | |
2374 | export (@pxref{HTML export}) will inline the image as a clickable | |
2375 | button. If there is no description at all and the link points to an | |
2376 | image, | |
2377 | that image will be inlined into the exported HTML file. | |
2378 | ||
2379 | @cindex angular brackets, around links | |
2380 | @cindex plain text external links | |
a7808fba | 2381 | Org also finds external links in the normal text and activates them |
4009494e GM |
2382 | as links. If spaces must be part of the link (for example in |
2383 | @samp{bbdb:Richard Stallman}), or if you need to remove ambiguities | |
2384 | about 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 |
2390 | Org provides methods to create a link in the correct syntax, to |
2391 | insert 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 | |
2397 | Store a link to the current location. This is a @emph{global} command | |
2398 | which can be used in any buffer to create a link. The link will be | |
a7808fba CD |
2399 | stored for later insertion into an Org buffer (see below). For |
2400 | Org files, if there is a @samp{<<target>>} at the cursor, the | |
28a16a1b | 2401 | link points to the target. Otherwise it points to the current |
a7808fba | 2402 | headline. For VM, Rmail, Wanderlust, MH-E, Gnus and BBDB buffers, the |
28a16a1b CD |
2403 | link will indicate the current article/entry. For W3 and W3M buffers, |
2404 | the link goes to the current URL. For IRC links, if you set the | |
2405 | variable @code{org-irc-link-to-logs} to non-nil then @kbd{C-c l} will | |
2406 | store a @samp{file:/} style link to the relevant point in the logs for | |
2407 | the current conversation. Otherwise an @samp{irc:/} style link to the | |
2408 | user/channel/server under the point will be stored. For any other | |
2409 | files, the link will point to the file, with a search string | |
2410 | (@pxref{Search options}) pointing to the contents of the current line. | |
2411 | If there is an active region, the selected words will form the basis | |
2412 | of the search string. If the automatically created link is not | |
2413 | working correctly or accurately enough, you can write custom functions | |
2414 | to select the search string and to do the search for particular file | |
2415 | types - see @ref{Custom searches}. The key binding @kbd{C-c l} is | |
2416 | only 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 |
2423 | Insert a link. This prompts for a link to be inserted into the buffer. You |
2424 | can just type a link, using text for an internal link, or one of the link | |
2425 | type prefixes mentioned in the examples above. All links stored during the | |
2426 | current session are part of the history for this prompt, so you can access | |
2427 | them with @key{up} and @key{down} (or @kbd{M-p/n}). Completion, on the other | |
2428 | hand, 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 | |
2431 | buffer@footnote{After insertion of a stored link, the link will be removed | |
2432 | from the list of stored links. To keep it in the list later use, use a | |
2433 | triple @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. | |
2435 | If some text was selected when this command is called, the selected text | |
2436 | becomes the default description.@* Note that you don't have to use this | |
2437 | command to insert a link. Links in Org are plain text, and you can type | |
2438 | or paste them straight into the buffer. By using this command, the links are | |
2439 | automatically enclosed in double brackets, and you will be asked for the | |
2440 | optional 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 | |
2451 | When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to | |
2452 | a file will be inserted and you may use file name completion to select | |
2453 | the name of the file. The path to the file is inserted relative to the | |
2454 | directory of the current org file, if the linked file is in the current | |
a7808fba | 2455 | directory or in a sub-directory of it, or if the path is written relative |
4009494e GM |
2456 | to the current directory using @samp{../}. Otherwise an absolute path |
2457 | is used, if possible with @samp{~/} for your home directory. You can | |
2458 | force an absolute path with two @kbd{C-u} prefixes. | |
2459 | @c | |
2460 | @item C-c C-l @r{(with cursor on existing link)} | |
2461 | When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the | |
2462 | link and description parts of the link. | |
2463 | @c | |
2464 | @cindex following links | |
2465 | @kindex C-c C-o | |
2466 | @item C-c C-o | |
2467 | Open 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 |
2469 | for the corresponding links, and execute the command in a shell link. |
2470 | When the cursor is on an internal link, this commands runs the | |
2471 | corresponding search. When the cursor is on a TAG list in a headline, | |
2472 | it creates the corresponding TAGS view. If the cursor is on a time | |
2473 | stamp, it compiles the agenda for that date. Furthermore, it will visit | |
2474 | text and remote files in @samp{file:} links with Emacs and select a | |
2475 | suitable application for local non-text files. Classification of files | |
2476 | is based on file extension only. See option @code{org-file-apps}. If | |
2477 | you want to override the default application and visit the file with | |
2478 | Emacs, use a @kbd{C-u} prefix. | |
2479 | @c | |
2480 | @kindex mouse-2 | |
2481 | @kindex mouse-1 | |
2482 | @item mouse-2 | |
2483 | @itemx mouse-1 | |
2484 | On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o} | |
2485 | would. Under Emacs 22, also @kbd{mouse-1} will follow a link. | |
2486 | @c | |
2487 | @kindex mouse-3 | |
2488 | @item mouse-3 | |
2489 | Like @kbd{mouse-2}, but force file links to be opened with Emacs, and | |
2490 | internal links to be displayed in another window@footnote{See the | |
2491 | variable @code{org-display-internal-link-with-indirect-buffer}}. | |
2492 | @c | |
2493 | @cindex mark ring | |
2494 | @kindex C-c % | |
2495 | @item C-c % | |
2496 | Push the current position onto the mark ring, to be able to return | |
2497 | easily. Commands following an internal link do this automatically. | |
2498 | @c | |
2499 | @cindex links, returning to | |
2500 | @kindex C-c & | |
2501 | @item C-c & | |
2502 | Jump back to a recorded position. A position is recorded by the | |
2503 | commands following internal links, and by @kbd{C-c %}. Using this | |
2504 | command several times in direct succession moves through a ring of | |
2505 | previously 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 | |
2512 | Move forward/backward to the next link in the buffer. At the limit of | |
2513 | the buffer, the search fails once, and then wraps around. The key | |
2514 | bindings for this are really too long, you might want to bind this also | |
2515 | to @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 |
2527 | You can insert and follow links that have Org syntax not only in |
2528 | Org, but in any Emacs buffer. For this, you should create two | |
4009494e GM |
2529 | global commands, like this (please select suitable global keys |
2530 | yourself): | |
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 | ||
2542 | Long URLs can be cumbersome to type, and often many similar links are | |
2543 | needed in a document. For this you can use link abbreviations. An | |
2544 | abbreviated link looks like this | |
2545 | ||
2546 | @example | |
2547 | [[linkword:tag][description]] | |
2548 | @end example | |
2549 | ||
2550 | @noindent | |
2551 | where the tag is optional. Such abbreviations are resolved according to | |
2552 | the information in the variable @code{org-link-abbrev-alist} that | |
2553 | relates 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 | ||
2565 | If the replacement text contains the string @samp{%s}, it will be | |
2566 | replaced with the tag. Otherwise the tag will be appended to the string | |
2567 | in order to create the link. You may also specify a function that will | |
2568 | be called with the tag as the only argument to create the link. | |
2569 | ||
2570 | With 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 |
2573 | doing besides Emacs hacking with @code{[[ads:Dominik,C]]}. |
2574 | ||
a7808fba | 2575 | If you need special abbreviations just for a single Org buffer, you |
4009494e GM |
2576 | can 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 | |
2584 | In-buffer completion @pxref{Completion} can be used after @samp{[} to | |
2585 | complete 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 | ||
2592 | File links can contain additional information to make Emacs jump to a | |
2593 | particular location in the file when following a link. This can be a | |
2594 | line number or a search option after a double@footnote{For backward | |
2595 | compatibility, line numbers can also follow a single colon.} colon. For | |
2596 | example, when the command @kbd{C-c l} creates a link (@pxref{Handling | |
2597 | links}) to a file, it encodes the words in the current line as a search | |
2598 | string that can be used to find this line back later when following the | |
28a16a1b | 2599 | link with @kbd{C-c C-o}. |
4009494e GM |
2600 | |
2601 | Here is the syntax of the different ways to attach a search to a file | |
2602 | link, 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 | |
2613 | Jump to line 255. | |
2614 | @item My Target | |
2615 | Search 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 | |
2618 | link will become an HTML reference to the corresponding named anchor in | |
2619 | the linked file. | |
2620 | @item *My Target | |
a7808fba | 2621 | In an Org file, restrict search to headlines. |
4009494e GM |
2622 | @item /regexp/ |
2623 | Do a regular expression search for @code{regexp}. This uses the Emacs | |
2624 | command @code{occur} to list all matches in a separate window. If the | |
a7808fba | 2625 | target file is in Org mode, @code{org-occur} is used to create a |
4009494e GM |
2626 | sparse 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 | ||
2631 | As a degenerate case, a file link with an empty file name can be used | |
2632 | to search the current file. For example, @code{[[file:::find me]]} does | |
2633 | a 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 | ||
2641 | The default mechanism for creating search strings and for doing the | |
2642 | actual search related to a file link may not work correctly in all | |
2643 | cases. For example, BibTeX database files have many entries like | |
2644 | @samp{year="1993"} which would not result in good search strings, | |
2645 | because the only unique identification for a BibTeX entry is the | |
2646 | citation key. | |
2647 | ||
2648 | If you come across such a problem, you can write custom functions to set | |
2649 | the right search string for a particular file type, and to do the search | |
2650 | for the string in the file. Using @code{add-hook}, these functions need | |
2651 | to 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 | 2654 | variables for more information. Org actually uses this mechanism |
4009494e GM |
2655 | for Bib@TeX{} database files, and you can use the corresponding code as |
2656 | an implementation example. Search for @samp{BibTeX links} in the source | |
2657 | file. | |
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 | 2665 | Org mode does not maintain TODO lists as separate documents. Instead, |
dbc28aaa | 2666 | TODO items are an integral part of the notes file, because TODO items |
a7808fba | 2667 | usually come up while taking notes! With Org mode, simply mark any |
dbc28aaa CD |
2668 | entry in a tree as being a TODO item. In this way, information is not |
2669 | duplicated, and the entire context from which the TODO item emerged is | |
2670 | always present. | |
4009494e | 2671 | |
dbc28aaa | 2672 | Of course, this technique for managing TODO items scatters them |
a7808fba | 2673 | throughout your notes file. Org mode compensates for this by providing |
dbc28aaa | 2674 | methods 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 |
2688 | Any 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 | |
2696 | The 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 | |
2702 | Rotate the TODO state of the current item among | |
2703 | ||
2704 | @example | |
2705 | ,-> (unmarked) -> TODO -> DONE --. | |
2706 | '--------------------------------' | |
2707 | @end example | |
2708 | ||
2709 | The same rotation can also be done ``remotely'' from the timeline and | |
2710 | agenda 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 | |
2714 | Select a specific keyword using completion or (if it has been set up) | |
28a16a1b CD |
2715 | the fast selection interface. For the latter, you need to assign keys |
2716 | to TODO states, see @ref{Per-file keywords} and @ref{Setting tags} for | |
2717 | more 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 |
2723 | Select the following/preceding TODO state, similar to cycling. Useful |
2724 | mostly if more than two TODO states are possible (@pxref{TODO | |
4009494e | 2725 | extensions}). |
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 |
2731 | View TODO items in a @emph{sparse tree} (@pxref{Sparse trees}). Folds |
2732 | the entire buffer, but shows all TODO items and the headings hierarchy | |
a7808fba | 2733 | above them. With a prefix argument, search for a specific TODO. You will be |
4009494e | 2734 | prompted 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 | 2736 | Nth keyword in the variable @code{org-todo-keywords}. With two prefix |
a7808fba | 2737 | arguments, find all TODO and DONE entries. |
4009494e GM |
2738 | @kindex C-c a t |
2739 | @item C-c a t | |
dbc28aaa | 2740 | Show the global TODO list. Collects the TODO items from all agenda |
a7808fba | 2741 | files (@pxref{Agenda Views}) into a single buffer. The new buffer will |
dbc28aaa CD |
2742 | be in @code{agenda-mode}, which provides commands to examine and |
2743 | manipulate the TODO entries from the new buffer (@pxref{Agenda | |
2744 | commands}). @xref{Global TODO list}, for more information. | |
4009494e GM |
2745 | @kindex S-M-@key{RET} |
2746 | @item S-M-@key{RET} | |
2747 | Insert 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 | 2754 | By default, marked TODO entries have one of only two states: TODO and |
a7808fba | 2755 | DONE. Org mode allows you to classify TODO items in more complex ways |
dbc28aaa CD |
2756 | with @emph{TODO keywords} (stored in @code{org-todo-keywords}). With |
2757 | special setup, the TODO keyword system can work differently in different | |
2758 | files. | |
4009494e GM |
2759 | |
2760 | Note that @i{tags} are another way to classify headlines in general and | |
2761 | TODO 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 | ||
2777 | You can use TODO keywords to indicate different @emph{sequential} states | |
2778 | in the process of working on an item, for example@footnote{Changing | |
a7808fba | 2779 | this variable only becomes effective after restarting Org mode in a |
4009494e GM |
2780 | buffer.}: |
2781 | ||
2782 | @lisp | |
2783 | (setq org-todo-keywords | |
2784 | '((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED"))) | |
2785 | @end lisp | |
2786 | ||
2787 | The vertical bar separates the TODO keywords (states that @emph{need | |
2788 | action}) from the DONE states (which need @emph{no further action}. If | |
2789 | you don't provide the separator bar, the last state is used as the DONE | |
2790 | state. | |
2791 | @cindex completion, of TODO keywords | |
2792 | With this setup, the command @kbd{C-c C-t} will cycle an entry from TODO | |
2793 | to FEEDBACK, then to VERIFY, and finally to DONE and DELEGATED. You may | |
a7808fba | 2794 | also use a numeric prefix argument to quickly select a specific state. For |
4009494e | 2795 | example @kbd{C-3 C-c C-t} will change the state immediately to VERIFY. |
28a16a1b CD |
2796 | Or you can use @kbd{S-left} to go backward through the sequence. If you |
2797 | define 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 | 2800 | buffer. 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 | ||
2809 | The second possibility is to use TODO keywords to indicate different | |
2810 | @emph{types} of action items. For example, you might want to indicate | |
2811 | that items are for ``work'' or ``home''. Or, when you work with several | |
2812 | people on a single project, you might want to assign action items | |
2813 | directly to persons, by using their names as TODO keywords. This would | |
2814 | be set up like this: | |
2815 | ||
2816 | @lisp | |
2817 | (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE"))) | |
2818 | @end lisp | |
2819 | ||
2820 | In this case, different keywords do not indicate a sequence, but rather | |
2821 | different types. So the normal work flow would be to assign a task to a | |
a7808fba CD |
2822 | person, and later to mark it DONE. Org mode supports this style by adapting |
2823 | the 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 | |
2825 | times in succession, it will still cycle through all names, in order to first | |
2826 | select the right type for a task. But when you return to the item after some | |
2827 | time and execute @kbd{C-c C-t} again, it will switch from any name directly | |
2828 | to DONE. Use prefix arguments or completion to quickly select a specific | |
2829 | name. You can also review the items of a specific TODO type in a sparse tree | |
2830 | by using a numeric prefix to @kbd{C-c C-v}. For example, to see all things | |
2831 | Lucy has to do, you would use @kbd{C-3 C-c C-v}. To collect Lucy's items | |
2832 | from all agenda files into a single buffer, you would use the numeric prefix | |
2833 | argument 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 | |
2839 | Sometimes you may want to use different sets of TODO keywords in | |
2840 | parallel. For example, you may want to have the basic | |
2841 | @code{TODO}/@code{DONE}, but also a workflow for bug fixing, and a | |
2842 | separate state indicating that an item has been canceled (so it is not | |
2843 | DONE, but also does not require action). Your setup would then look | |
2844 | like 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 | 2853 | The keywords should all be different, this helps Org mode to keep track |
4009494e GM |
2854 | of 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 | |
2858 | select the correct sequence. Besides the obvious ways like typing a | |
2859 | keyword 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} | |
2866 | These 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>}} | |
2875 | would 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 | ||
2881 | If you would like to quickly change an entry to an arbitrary TODO state | |
2882 | instead of cycling through the states, you can set up keys for | |
2883 | single-letter access to the states. This is done by adding the section | |
2884 | key 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 | ||
2893 | If you then press @code{C-u C-c C-t} followed by the selection key, the | |
2894 | entry will be switched to this state. @key{SPC} can be used to remove | |
2895 | any TODO keyword from an entry. Should you like this way of selecting | |
2896 | TODO states a lot, you might want to set the variable | |
2897 | @code{org-use-fast-todo-selection} to @code{t} and make this behavior | |
2898 | the default. Check also the variable | |
2899 | @code{org-fast-tag-selection-include-todo}, it allows to change the TODO | |
28a16a1b CD |
2900 | state through the tags interface (@pxref{Setting tags}), in case you |
2901 | like 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 | |
2908 | It can be very useful to use different aspects of the TODO mechanism in | |
2909 | different files. For file-local settings, you need to add special lines | |
2910 | to the file which set the keywords and interpretation for that file | |
2911 | only. For example, to set one of the two examples discussed above, you | |
2912 | need one of the following lines, starting in column zero anywhere in the | |
2913 | file: | |
2914 | ||
2915 | @example | |
2916 | #+SEQ_TODO: TODO FEEDBACK VERIFY | DONE CANCELED | |
2917 | @end example | |
2918 | or | |
2919 | @example | |
2920 | #+TYP_TODO: Fred Sara Lucy Mike | DONE | |
2921 | @end example | |
2922 | ||
2923 | A 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 | |
2937 | Remember that the keywords after the vertical bar (or the last keyword | |
2938 | if no bar is there) must always mean that the item is DONE (although you | |
2939 | may 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 |
2941 | known to Org mode@footnote{Org mode parses these lines only when |
2942 | Org mode is activated after visiting a file. @kbd{C-c C-c} with the | |
2943 | cursor in a line starting with @samp{#+} is simply restarting Org mode | |
4009494e GM |
2944 | for 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 | 2950 | Org mode highlights TODO keywords with special faces: @code{org-todo} |
dbc28aaa CD |
2951 | for 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 | |
2953 | you are using more than 2 different states, you might want to use | |
2954 | special 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 |
2964 | While using a list with face properties as shown for CANCELED |
2965 | @emph{should} work, this does not aways seem to be the case. If | |
2966 | necessary, 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 | 2974 | Org mode can automatically record a time stamp and possibly a note when |
28a16a1b CD |
2975 | you mark a TODO item as DONE, or even each time you change the state of |
2976 | a TODO item. This system is highly configurable, settings can be on a | |
2977 | per-keyword basis and can be localized to a file or even a subtree. For | |
2978 | information on how to clock working time for a task, see @ref{Clocking | |
2979 | work 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 |
2989 | The most basic logging is to keep track of @emph{when} a certain TODO |
2990 | item was finished. This is achieved with@footnote{The corresponding | |
2991 | in-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 |
2998 | Then each time you turn an entry from a TODO (not-done) state into any |
2999 | of the DONE states, a line @samp{CLOSED: [timestamp]} will be inserted | |
3000 | just after the headline. If you turn the entry back into a TODO item | |
3001 | through further state cycling, that line will be removed again. If you | |
3002 | want to record a note along with the timestamp, use@footnote{The | |
3003 | corresponding 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 |
3010 | You will then be prompted for a note, and that note will be stored below | |
3011 | the entry with a @samp{Closing Note} heading. | |
3012 | ||
3013 | In 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 |
3015 | display the TODO items with a @samp{CLOSED} timestamp on each day, |
3016 | giving 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 | ||
3021 | When TODO keywords are used as workflow states (@pxref{Workflow | |
3022 | states}), you might want to keep track of when a state change occurred | |
28a16a1b | 3023 | and maybe take a note about this change. Since it is normally too much |
a7808fba | 3024 | to record a note for every state, Org mode expects configuration on a |
28a16a1b CD |
3025 | per-keyword basis for this. This is achieved by adding special markers |
3026 | @samp{!} (for a time stamp) and @samp{@@} (for a note) in parenthesis | |
3027 | after 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 |
3035 | you not only define global TODO keywords and fast access keys, but also |
3036 | request that a time is recorded when the entry is turned into | |
a7808fba | 3037 | DONE@footnote{It is possible that Org mode will record two time stamps |
28a16a1b CD |
3038 | when you are using both @code{org-log-done} and state change logging. |
3039 | However, it will never prompt for two notes - if you have configured | |
3040 | both, the state change recording note will take precedence and cancel | |
3041 | the @samp{Closing Note}.}, and that a note is recorded when switching to | |
3042 | WAIT 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 | |
3044 | entering the state, a time stamp should be recorded when @i{leaving} the | |
3045 | WAIT state, if and only if the @i{target} state does not configure | |
3046 | logging for entering it. So it has no effect when switching from WAIT | |
3047 | to DONE, because DONE is configured to record a timestamp only. But | |
3048 | when switching from WAIT back to TODO, the @samp{/!} in the WAIT | |
3049 | setting now triggers a timestamp even though TODO has no logging | |
3050 | configured. | |
3051 | ||
3052 | You can use the exact same syntax for setting logging preferences local | |
3053 | to a buffer: | |
3054 | @example | |
3055 | #+SEQ_TODO: TODO(t) WAIT(w@@/!) | DONE(d!) CANCELED(c@@) | |
3056 | @end example | |
3057 | ||
3058 | In order to define logging settings that are local to a subtree or a | |
3059 | single item, define a LOGGING property in this entry. Any non-empty | |
3060 | LOGGING property resets all logging settings to nil. You may then turn | |
3061 | on logging for this specific tree using STARTUP keywords like | |
3062 | @code{lognotedone} or @code{logrepeat}, as well as adding state specific | |
3063 | settings 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 | 3085 | If you use Org mode extensively, you may end up enough TODO items that |
dbc28aaa CD |
3086 | it starts to make sense to prioritize them. Prioritizing can be done by |
3087 | placing a @emph{priority cookie} into the headline of a TODO item, like | |
3088 | this | |
4009494e GM |
3089 | |
3090 | @example | |
3091 | *** TODO [#A] Write letter to Sam Fortune | |
3092 | @end example | |
3093 | ||
3094 | @noindent | |
a7808fba | 3095 | By 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 |
3097 | is treated as priority @samp{B}. Priorities make a difference only in | |
a7808fba CD |
3098 | the agenda (@pxref{Weekly/daily agenda}); outside the agenda, they have |
3099 | no inherent meaning to Org mode. | |
dbc28aaa CD |
3100 | |
3101 | Priorities can be attached to any outline tree entries; they do not need | |
3102 | to be TODO items. | |
4009494e GM |
3103 | |
3104 | @table @kbd | |
3105 | @kindex @kbd{C-c ,} | |
3106 | @item @kbd{C-c ,} | |
3107 | Set the priority of the current headline. The command prompts for a | |
3108 | priority character @samp{A}, @samp{B} or @samp{C}. When you press | |
3109 | @key{SPC} instead, the priority cookie is removed from the headline. | |
3110 | The priorities can also be changed ``remotely'' from the timeline and | |
3111 | agenda 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 |
3117 | Increase/decrease priority of current headline@footnote{See also the |
3118 | option @code{org-priority-start-cycle-with-default'}.}. Note that these | |
3119 | keys are also used to modify time stamps (@pxref{Creating timestamps}). | |
a7808fba | 3120 | Furthermore, these keys are also used by CUA mode (@pxref{Conflicts}). |
4009494e GM |
3121 | @end table |
3122 | ||
3123 | You 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 | |
3126 | these values (highest, lowest, default) like this (please make sure that | |
3127 | the highest priority is earlier in the alphabet than the lowest | |
3128 | priority): | |
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 | ||
3138 | It is often advisable to break down large tasks into smaller, manageable | |
3139 | subtasks. You can do this by creating an outline tree below a TODO | |
3140 | item, with detailed subtasks on the tree@footnote{To keep subtasks out | |
3141 | of the global TODO list, see the | |
3142 | @code{org-agenda-todo-list-sublevels}.}. Another possibility is the use | |
3143 | of 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 |
3151 | Every item in a plain list (@pxref{Plain lists}) can be made into a |
3152 | checkbox by starting it with the string @samp{[ ]}. This feature is | |
a7808fba | 3153 | similar to TODO items (@pxref{TODO Items}), but is more lightweight. |
dbc28aaa CD |
3154 | Checkboxes are not included into the global TODO list, so they are often |
3155 | great to split a task into a number of simple steps. Or you can use | |
3156 | them in a shopping list. To toggle a checkbox, use @kbd{C-c C-c}, or | |
3157 | use the mouse (thanks to Piotr Zielinski's @file{org-mouse.el}). | |
3158 | ||
3159 | Here 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 |
3172 | Checkboxes work hierarchically, so if a checkbox item has children that |
3173 | are checkboxes, toggling one of the children checkboxes will make the | |
3174 | parent checkbox reflect if none, some, or all of the children are | |
3175 | checked. | |
3176 | ||
4009494e GM |
3177 | @cindex statistics, for checkboxes |
3178 | @cindex checkbox statistics | |
28a16a1b | 3179 | The @samp{[2/4]} and @samp{[1/3]} in the first and second line are |
dbc28aaa CD |
3180 | cookies indicating how many checkboxes present in this entry have been |
3181 | checked off, and the total number of checkboxes are present. This can | |
3182 | give you an idea on how many checkboxes remain, even without opening a | |
3183 | folded entry. The cookies can be placed into a headline or into (the | |
3184 | first line of) a plain list item. Each cookie covers all checkboxes | |
3185 | structurally below the headline/item on which the cookie appear. You | |
3186 | have 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 | |
3188 | the examples above. With @samp{[%]} you get information about the | |
4009494e | 3189 | percentage 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 | 3197 | Toggle checkbox at point. With a prefix argument, set it to @samp{[-]}, |
4009494e GM |
3198 | which is considered to be an intermediate state. |
3199 | @kindex C-c C-x C-b | |
3200 | @item C-c C-x C-b | |
3201 | Toggle checkbox at point. | |
3202 | @itemize @minus | |
3203 | @item | |
3204 | If there is an active region, toggle the first checkbox in the region | |
3205 | and set all remaining boxes to the same status as the first. If you | |
3206 | want to toggle all boxes in the region independently, use a prefix | |
3207 | argument. | |
3208 | @item | |
3209 | If the cursor is in a headline, toggle checkboxes in the region between | |
3210 | this headline and the next (so @emph{not} the entire subtree). | |
3211 | @item | |
3212 | If 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} | |
3216 | Insert a new item with a checkbox. | |
3217 | This works only if the cursor is already in a plain list item | |
3218 | (@pxref{Plain lists}). | |
3219 | @kindex C-c # | |
3220 | @item C-c # | |
3221 | Update the checkbox statistics in the current outline entry. When | |
3222 | called with a @kbd{C-u} prefix, update the entire file. Checkbox | |
3223 | statistic cookies are updated automatically if you toggle checkboxes | |
3224 | with @kbd{C-c C-c} and make new ones with @kbd{M-S-@key{RET}}. If you | |
3225 | delete boxes or add/change them by hand, use this command to get things | |
3226 | back 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 | 3236 | An excellent way to implement labels and contexts for cross-correlating |
a7808fba | 3237 | information is to assign @i{tags} to headlines. Org mode has extensive |
dbc28aaa | 3238 | support for tags. |
4009494e | 3239 | |
dbc28aaa CD |
3240 | Every headline can contain a list of tags; they occur at the end of the |
3241 | headline. Tags are normal words containing letters, numbers, @samp{_}, | |
3242 | and @samp{@@}. Tags must be preceded and followed by a single colon, | |
3243 | e.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 | |
3259 | heading has a certain tag, all subheadings will inherit the tag as | |
3260 | well. 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 |
3269 | the final heading will have the tags @samp{:work:}, @samp{:boss:}, |
3270 | @samp{:notes:}, and @samp{:action:} even though the final heading is not | |
3271 | explicitly marked with those tags. When executing tag searches and | |
a7808fba | 3272 | Org mode finds that a certain headline matches the search criterion, it |
dbc28aaa CD |
3273 | will not check any sublevel headline, assuming that these also match and |
3274 | that the list of matches could become very long because of that. If you | |
a7808fba CD |
3275 | do want the sublevels be tested and listed as well, you may set the |
3276 | variable @code{org-tags-match-list-sublevels}. To limit tag inheritance | |
3277 | to 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} | |
3286 | Tags can simply be typed into the buffer at the end of a headline. | |
3287 | After a colon, @kbd{M-@key{TAB}} offers completion on tags. There is | |
3288 | also 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 | 3294 | Enter new tags for the current headline. Org mode will either offer |
4009494e GM |
3295 | completion or a special single-key interface for setting tags, see |
3296 | below. After pressing @key{RET}, the tags will be inserted and aligned | |
3297 | to @code{org-tags-column}. When called with a @kbd{C-u} prefix, all | |
3298 | tags in the current buffer will be aligned to that column, just to make | |
3299 | things look nice. TAGS are automatically realigned after promotion, | |
3300 | demotion, and TODO state changes (@pxref{TODO basics}). | |
3301 | @end table | |
3302 | ||
3303 | Org will support tag insertion based on a @emph{list of tags}. By | |
3304 | default this list is constructed dynamically, containing all tags | |
3305 | currently used in the buffer. You may also globally specify a hard list | |
3306 | of tags with the variable @code{org-tag-alist}. Finally you can set | |
3307 | the 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 | ||
3314 | If you have globally defined your preferred set of tags using the | |
3315 | variable @code{org-tag-alist}, but would like to use a dynamic tag list | |
dbc28aaa | 3316 | in 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 |
3322 | By default Org mode uses the standard minibuffer completion facilities for |
3323 | entering tags. However, it also implements another, quicker, tag selection | |
3324 | method called @emph{fast tag selection}. This allows you to select and | |
3325 | deselect tags with just a single key press. For this to work well you should | |
3326 | assign unique letters to most of your commonly used tags. You can do this | |
3327 | globally 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 | |
3329 | different files with @samp{:@@home:}. In this case you can set something | |
3330 | like: | |
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 |
3337 | can, 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 |
3344 | You can also group together tags that are mutually exclusive. By using |
3345 | braces, 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 | 3352 | and @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 | |
3355 | these lines to activate any changes. | |
3356 | ||
a7808fba CD |
3357 | @noindent |
3358 | To set these mutually exclusive groups in the variable @code{org-mode-alist} | |
3359 | you must use the dummy tags @code{:startgroup} and @code{:endgroup} instead | |
3360 | of the braces. The previous example would be set globally by the following | |
3361 | configuration: | |
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 | ||
3371 | If at least one tag has a selection key then pressing @kbd{C-c C-c} will | |
3372 | automatically present you with a special interface, listing inherited tags, | |
3373 | the tags of the current headline, and a list of all valid tags with | |
3374 | corresponding keys@footnote{Keys will automatically be assigned to tags which | |
3375 | have no configured keys.}. In this interface, you can use the following | |
3376 | keys: | |
4009494e GM |
3377 | |
3378 | @table @kbd | |
3379 | @item a-z... | |
3380 | Pressing keys assigned to tags will add or remove them from the list of | |
3381 | tags in the current line. Selecting a tag in a group of mutually | |
3382 | exclusive tags will turn off any other tags from that group. | |
3383 | @kindex @key{TAB} | |
3384 | @item @key{TAB} | |
3385 | Enter a tag in the minibuffer, even if the tag is not in the predefined | |
3386 | list. You will be able to complete on all tags present in the buffer. | |
3387 | @kindex @key{SPC} | |
3388 | @item @key{SPC} | |
3389 | Clear all tags for this line. | |
3390 | @kindex @key{RET} | |
3391 | @item @key{RET} | |
3392 | Accept the modified set. | |
3393 | @item C-g | |
3394 | Abort without installing changes. | |
3395 | @item q | |
3396 | If @kbd{q} is not assigned to a tag, it aborts like @kbd{C-g}. | |
3397 | @item ! | |
3398 | Turn off groups of mutually exclusive tags. Use this to (as an | |
3399 | exception) assign several tags from such a group. | |
3400 | @item C-c | |
3401 | Toggle auto-exit after the next change (see below). | |
3402 | If you are using expert mode, the first @kbd{C-c} will display the | |
3403 | selection window. | |
3404 | @end table | |
3405 | ||
3406 | @noindent | |
3407 | This method lets you assign tags to a headline with very few keys. With | |
dbc28aaa CD |
3408 | the 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 | |
3410 | C-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 |
3412 | alternatively 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 | 3416 | If you find that most of the time, you need only a single key press to |
4009494e GM |
3417 | modify your list of tags, set the variable |
3418 | @code{org-fast-tag-selection-single-key}. Then you no longer have to | |
3419 | press @key{RET} to exit fast tag selection - it will immediately exit | |
3420 | after 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 | |
3423 | C-c}). If you set the variable to the value @code{expert}, the special | |
3424 | window is not even shown for single-key tag selection, it comes up only | |
3425 | when 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 | 3432 | Once a system of tags has been set up, it can be used to collect related |
4009494e GM |
3433 | information 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 |
3440 | Create 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 | |
3444 | Create 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 | |
3448 | Create a global list of tag matches from all agenda files, but check | |
3449 | only 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 | |
3454 | A @i{tags} search string can use Boolean operators @samp{&} for AND and | |
3455 | @samp{|} for OR. @samp{&} binds more strongly than @samp{|}. | |
3456 | Parenthesis are currently not implemented. A tag may also be preceded | |
3457 | by @samp{-}, to select against it, and @samp{+} is syntactic sugar for | |
3458 | positive selection. The AND operator @samp{&} is optional when @samp{+} | |
3459 | or @samp{-} is present. Examples: | |
3460 | ||
3461 | @table @samp | |
dbc28aaa CD |
3462 | @item +work-boss |
3463 | Select headlines tagged @samp{:work:}, but discard those also tagged | |
3464 | @samp{:boss:}. | |
3465 | @item work|laptop | |
3466 | Selects lines tagged @samp{:work:} or @samp{:laptop:}. | |
3467 | @item work|laptop&night | |
3468 | Like 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 | |
3473 | If you are using multi-state TODO keywords (@pxref{TODO extensions}), it | |
3474 | can be useful to also match on the TODO keyword. This can be done by | |
3475 | adding a condition after a slash to a tags match. The syntax is similar | |
3476 | to the tag matches, but should be applied with consideration: For | |
3477 | example, a positive selection on several TODO keywords can not | |
3478 | meaningfully be combined with boolean AND. However, @emph{negative | |
3479 | selection} combined with AND can be meaningful. To make sure that only | |
3480 | lines are checked that actually have any TODO keyword, use @kbd{C-c a | |
a7808fba | 3481 | M}, or equivalently start the TODO part after the slash with @samp{!}. |
4009494e GM |
3482 | Examples: |
3483 | ||
3484 | @table @samp | |
dbc28aaa CD |
3485 | @item work/WAITING |
3486 | Select @samp{:work:}-tagged TODO lines with the specific TODO | |
4009494e | 3487 | keyword @samp{WAITING}. |
dbc28aaa CD |
3488 | @item work/!-WAITING-NEXT |
3489 | Select @samp{:work:}-tagged TODO lines that are neither @samp{WAITING} | |
4009494e | 3490 | nor @samp{NEXT} |
dbc28aaa CD |
3491 | @item work/+WAITING|+NEXT |
3492 | Select @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 | |
3497 | Any element of the tag/todo match can be a regular expression - in this | |
3498 | case 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 | |
3504 | You can also require a headline to be of a certain level or category, by | |
3505 | writing 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 | 3508 | tag @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 | ||
3514 | Properties are a set of key-value pairs associated with an entry. There | |
a7808fba | 3515 | are two main applications for properties in Org mode. First, properties |
dbc28aaa | 3516 | are like tags, but with a value. Second, you can use properties to |
a7808fba | 3517 | implement (very basic) database capabilities in an Org buffer. For |
dbc28aaa CD |
3518 | an example of the first application, imagine maintaining a file where |
3519 | you document bugs and plan releases of a piece of software. Instead of | |
3520 | using tags like @code{:release_1:}, @code{:release_2:}, one can use a | |
3521 | property, say @code{:Release:}, that in different subtrees has different | |
3522 | values, such as @code{1.0} or @code{2.0}. For an example of the second | |
a7808fba | 3523 | application of properties, imagine keeping track of your music CD's, |
dbc28aaa CD |
3524 | where properties could be things such as the album artist, date of |
3525 | release, number of tracks, and so on. | |
3526 | ||
28a16a1b | 3527 | Properties can be conveniently edited and viewed in column view |
dbc28aaa CD |
3528 | (@pxref{Column view}). |
3529 | ||
3530 | Properties are like tags, but with a value. For example, in a file | |
3531 | where you document bugs and plan releases of a piece of software, | |
3532 | instead of using tags like @code{:release_1:}, @code{:release_2:}, it | |
3533 | can 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 | 3536 | create a list of Music CD's you own. You can edit and view properties |
4009494e GM |
3537 | conveniently 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 | ||
3553 | Properties are key-value pairs. They need to be inserted into a special | |
3554 | drawer (@pxref{Drawers}) with the name @code{PROPERTIES}. Each property | |
3555 | is specified on a single line, with the key (surrounded by colons) | |
3556 | first, 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 |
3571 | You may define the allowed values for a particular property @samp{:Xyz:} |
3572 | by 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 |
3574 | the entire tree. When allowed values are defined, setting the | |
3575 | corresponding property becomes easier and is less prone to typing | |
3576 | errors. For the example with the CD collection, we can predefine | |
3577 | publishers 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 | ||
3587 | If you want to set properties that can be inherited by any entry in a | |
3588 | file, use a line like | |
3589 | ||
3590 | @example | |
3591 | #+PROPERTY: NDisks_ALL 1 2 3 4 | |
3592 | @end example | |
3593 | ||
3594 | Property values set with the global variable | |
3595 | @code{org-global-properties} can be inherited by all entries in all | |
a7808fba | 3596 | Org files. |
4009494e GM |
3597 | |
3598 | @noindent | |
3599 | The following commands help to work with properties: | |
3600 | ||
3601 | @table @kbd | |
3602 | @kindex M-@key{TAB} | |
3603 | @item M-@key{TAB} | |
3604 | After an initial colon in a line, complete property keys. All keys used | |
3605 | in 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 | |
3608 | Set a property. This prompts for a property name and a value. If | |
3609 | necessary, the property drawer is created as well. | |
4009494e GM |
3610 | @item M-x org-insert-property-drawer |
3611 | Insert a property drawer into the current entry. The drawer will be | |
3612 | inserted early in the entry, but after the lines with planning | |
3613 | information like deadlines. | |
3614 | @kindex C-c C-c | |
3615 | @item C-c C-c | |
3616 | With the cursor in a property drawer, this executes property commands. | |
3617 | @item C-c C-c s | |
3618 | Set a property in the current entry. Both the property and the value | |
3619 | can be inserted using completion. | |
3620 | @kindex S-@key{right} | |
3621 | @kindex S-@key{left} | |
3622 | @item S-@key{left}/@key{right} | |
3623 | Switch property at point to the next/previous allowed value. | |
3624 | @item C-c C-c d | |
3625 | Remove a property from the current entry. | |
3626 | @item C-c C-c D | |
3627 | Globally remove a property, from all entries in the current file. | |
dbc28aaa CD |
3628 | @item C-c C-c c |
3629 | Compute the property at point, using the operator and scope from the | |
3630 | nearest 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 | 3637 | Special properties provide alternative access method to Org mode |
4009494e GM |
3638 | features discussed in the previous chapters, like the TODO state or the |
3639 | priority of an entry. This interface exists so that you can include | |
dbc28aaa CD |
3640 | these states into columns view (@pxref{Column view}), or to use them in |
3641 | queries. The following property names are special and should not be | |
3642 | used as keys in the properties drawer: | |
4009494e GM |
3643 | |
3644 | @example | |
3645 | TODO @r{The TODO keyword of the entry.} | |
3646 | TAGS @r{The tags defined directly in the headline.} | |
3647 | ALLTAGS @r{All tags, including inherited ones.} | |
3648 | PRIORITY @r{The priority of the entry, a string with a single letter.} | |
3649 | DEADLINE @r{The deadline time string, without the angular brackets.} | |
3650 | SCHEDULED @r{The scheduling time stamp, without the angular brackets.} | |
dbc28aaa CD |
3651 | TIMESTAMP @r{The first keyword-less time stamp in the entry.} |
3652 | TIMESTAMP_IA @r{The first inactive time stamp in the entry.} | |
3653 | CLOCKSUM @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 |
3662 | To create sparse trees and special lists with selection based on properties, |
3663 | the same commands are used as for tag searches (@pxref{Tag searches}), and | |
3664 | the 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 |
3671 | If the comparison value is a plain number, a numerical comparison is done, |
3672 | and the allowed operators are @samp{<}, @samp{=}, @samp{>}, @samp{<=}, | |
3673 | @samp{>=}, and @samp{<>}. If the comparison value is enclosed in double | |
3674 | quotes, a string comparison is done, and the same operators are allowed. If | |
3675 | the comparison value is enclosed in curly braces, a regexp match is | |
3676 | performed, with @samp{=} meaning that the regexp matches the property value, | |
3677 | and @samp{<>} meaning that it does not match. So the search string in the | |
3678 | example finds entries tagged @samp{:work:} but not @samp{:boss:}, which also | |
3679 | have a priority value @samp{A}, a @samp{:Coffee:} property with the value | |
3680 | @samp{unlimited}, an @samp{Effort} property that is numerically smaller than | |
3681 | 2, and a @samp{:With:} property that is matched by the regular expression | |
3682 | @samp{Sarah\|Denny}. | |
3683 | ||
3684 | You can configure Org mode to use property inheritance during a search, but | |
3685 | beware that this can slow down searches considerably. See @ref{Property | |
3686 | inheritance} for details. | |
dbc28aaa CD |
3687 | |
3688 | There is also a special command for creating sparse trees based on a | |
3689 | single property: | |
3690 | ||
3691 | @table @kbd | |
3692 | @kindex C-c / p | |
3693 | @item C-c / p | |
3694 | Create a sparse tree based on the value of a property. This first | |
3695 | prompts for the name of a property, and then for a value. A sparse tree | |
3696 | is created with all entries that define this property with the given | |
3697 | value. If you enclose the value into curly braces, it is interpreted as | |
3698 | a 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 | 3706 | The outline structure of Org mode documents lends itself for an |
dbc28aaa | 3707 | inheritance model of properties: If the parent in a tree has a certain |
a7808fba | 3708 | property, the children can inherit this property. Org mode does not |
dbc28aaa CD |
3709 | turn this on by default, because it can slow down property searches |
3710 | significantly and is often not needed. However, if you find inheritance | |
3711 | useful, 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 |
3713 | all properties inherited from the parent, to a list of properties |
3714 | that should be inherited, or to a regular expression that matches | |
3715 | inherited properties. | |
dbc28aaa | 3716 | |
a7808fba | 3717 | Org mode has a few properties for which inheritance is hard-coded, at |
dbc28aaa CD |
3718 | least for the special applications for which they are used: |
3719 | ||
3720 | @table @code | |
3721 | @item COLUMNS | |
3722 | The @code{:COLUMNS:} property defines the format of column view | |
3723 | (@pxref{Column view}). It is inherited in the sense that the level | |
3724 | where a @code{:COLUMNS:} property is defined is used as the starting | |
3725 | point for a column view table, independently of the location in the | |
3726 | subtree from where columns view is turned on. | |
3727 | @item CATEGORY | |
3728 | For agenda view, a category set through a @code{:CATEGORY:} property | |
3729 | applies to the entire subtree. | |
3730 | @item ARCHIVE | |
3731 | For archiving, the @code{:ARCHIVE:} property may define the archive | |
3732 | location for the entire subtree (@pxref{Moving subtrees}). | |
28a16a1b CD |
3733 | @item LOGGING |
3734 | The LOGGING property may define logging settings for an entry or a | |
3735 | subtree (@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 | |
3741 | A 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 | |
3743 | table row. Columns in this table provide access to properties of the | |
a7808fba | 3744 | entries. Org mode implements columns by overlaying a tabular structure |
4009494e GM |
3745 | over the headline of each item. While the headlines have been turned |
3746 | into a table row, you can still change the visibility of the outline | |
3747 | tree. For example, you get a compact table by switching to CONTENTS | |
3748 | view (@kbd{S-@key{TAB} S-@key{TAB}}, or simply @kbd{c} while column view | |
3749 | is active), but you can still open, read, and edit the entry below each | |
3750 | headline. Or, you can switch to column view after executing a sparse | |
3751 | tree command and in this way get a table only for the selected items. | |
a7808fba | 3752 | Column view also works in agenda buffers (@pxref{Agenda Views}) where |
4009494e GM |
3753 | queries 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 | ||
3766 | Setting up a column view first requires defining the columns. This is | |
3767 | done 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 | ||
3777 | To 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 |
3783 | To 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 | 3793 | If a @code{:COLUMNS:} property is present in an entry, it defines columns |
4009494e GM |
3794 | for the entry itself, and for the entire subtree below it. Since the |
3795 | column definition is part of the hierarchical structure of the document, | |
3796 | you can define columns on level 1 that are general enough for all | |
3797 | sublevels, and more specific columns further down, when you edit a | |
3798 | deeper part of the tree. | |
3799 | ||
3800 | @node Column attributes, , Scope of column definitions, Defining columns | |
3801 | @subsubsection Column attributes | |
3802 | A column definition sets the attributes of a column. The general | |
3803 | definition looks like this: | |
3804 | ||
3805 | @example | |
3806 | %[width]property[(title)][@{summary-type@}] | |
3807 | @end example | |
3808 | ||
3809 | @noindent | |
3810 | Except for the percent sign and the property name, all items are | |
3811 | optional. The individual parts have the following meaning: | |
3812 | ||
3813 | @example | |
3814 | width @r{An integer specifying the width of the column in characters.} | |
3815 | @r{If omitted, the width will be determined automatically.} | |
3816 | property @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 | |
3832 | Here is an example for a complete columns definition, along with allowed | |
3833 | values. | |
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 | ||
3843 | The first column, @samp{%25ITEM}, means the first 25 characters of the | |
3844 | item itself, i.e. of the headline. You probably always should start the | |
28a16a1b CD |
3845 | column definition with the @samp{ITEM} specifier. The other specifiers |
3846 | create 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 |
3848 | field @samp{Approved}. When no width is given after the @samp{%} | |
3849 | character, the column will be exactly as wide as it needs to be in order | |
3850 | to fully display all values. The @samp{Approved} column does have a | |
3851 | modified title (@samp{Approved?}, with a question mark). Summaries will | |
dbc28aaa | 3852 | be created for the @samp{Time_Estimate} column by adding time duration |
4009494e | 3853 | expressions like HH:MM, and for the @samp{Approved} column, by providing |
dbc28aaa CD |
3854 | an @samp{[X]} status if all children have been checked. The |
3855 | @samp{CLOCKSUM} column is special, it lists the sum of CLOCK intervals | |
3856 | in 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 | |
3865 | Create the column view for the local environment. This command searches | |
dbc28aaa | 3866 | the hierarchy, up from point, for a @code{:COLUMNS:} property that defines |
4009494e | 3867 | a format. When one is found, the column view table is established for |
dbc28aaa | 3868 | the entire tree, starting from the entry that contains the @code{:COLUMNS:} |
4009494e GM |
3869 | property. If none is found, the format is taken from the @code{#+COLUMNS} |
3870 | line or from the variable @code{org-columns-default-format}, and column | |
3871 | view is established for the current entry and its subtree. | |
28a16a1b CD |
3872 | @kindex r |
3873 | @item r | |
a7808fba | 3874 | Recreate the column view, to include recent changes made in the buffer. |
28a16a1b CD |
3875 | @kindex g |
3876 | @item g | |
3877 | Same as @kbd{r}. | |
4009494e GM |
3878 | @kindex q |
3879 | @item q | |
3880 | Exit column view. | |
3881 | @tsubheading{Editing values} | |
3882 | @item @key{left} @key{right} @key{up} @key{down} | |
3883 | Move 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} | |
3887 | Switch to the next/previous allowed value of the field. For this, you | |
3888 | have to have specified allowed values for a property. | |
3889 | @kindex n | |
3890 | @kindex p | |
3891 | @itemx n / p | |
3892 | Same as @kbd{S-@key{left}/@key{right}} | |
3893 | @kindex e | |
3894 | @item e | |
3895 | Edit the property at point. For the special properties, this will | |
3896 | invoke the same interface that you normally use to change that | |
3897 | property. For example, when editing a TAGS property, the tag completion | |
3898 | or fast selection interface will pop up. | |
dbc28aaa CD |
3899 | @kindex C-c C-c |
3900 | @item C-c C-c | |
3901 | When there is a checkbox at point, toggle it. | |
4009494e GM |
3902 | @kindex v |
3903 | @item v | |
3904 | View the full value of this property. This is useful if the width of | |
3905 | the column is smaller than that of the value. | |
3906 | @kindex a | |
3907 | @item a | |
3908 | Edit the list of allowed values for this property. If the list is found | |
3909 | in the hierarchy, the modified values is stored there. If no list is | |
3910 | found, the new value is stored in the first entry that is part of the | |
3911 | current column view. | |
3912 | @tsubheading{Modifying the table structure} | |
3913 | @kindex < | |
3914 | @kindex > | |
3915 | @item < / > | |
3916 | Make the column narrower/wider by one character. | |
3917 | @kindex S-M-@key{right} | |
3918 | @item S-M-@key{right} | |
3919 | Insert a new column, to the right of the current column. | |
3920 | @kindex S-M-@key{left} | |
3921 | @item S-M-@key{left} | |
3922 | Delete 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 | |
3928 | Since column view is just an overlay over a buffer, it cannot be | |
3929 | exported or printed directly. If you want to capture a column view, use | |
a7808fba | 3930 | this @code{columnview} dynamic block (@pxref{Dynamic blocks}). The frame |
28a16a1b | 3931 | of 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 | |
3944 | This is most important parameter. Column view is a feature that is | |
3945 | often localized to a certain (sub)tree, and the capture block might be | |
3946 | in a different location in the file. To identify the tree whose view to | |
3947 | capture, you can use 3 values: | |
3948 | @example | |
3949 | local @r{use the tree in which the capture block is located} | |
3950 | global @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 | |
3955 | When @code{t}, insert a hline after every line. When a number N, insert | |
3956 | a hline before each headline with level @code{<= N}. | |
3957 | @item :vlines | |
3958 | When set to @code{t}, enforce column groups to get vertical lines. | |
28a16a1b CD |
3959 | @item :maxlevel |
3960 | When set to a number, don't capture entries below this level. | |
3961 | @item :skip-empty-rows | |
3962 | When set to @code{t}, skip row where the only non-empty specifier of the | |
3963 | column view is @code{ITEM}. | |
3964 | ||
dbc28aaa CD |
3965 | @end table |
3966 | ||
3967 | @noindent | |
3968 | The 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 | |
3973 | Insert a dynamic block capturing a column view. You will be prompted | |
3974 | for 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 | |
3979 | Update 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 | |
3983 | Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if | |
a7808fba | 3984 | you 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 | ||
3992 | There is a full API for accessing and changing properties. This API can | |
3993 | be used by Emacs Lisp programs to work with properties and to implement | |
3994 | features based on them. For more information see @ref{Using the | |
3995 | property 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 |
4004 | To assist project planning, TODO items can be labeled with a date and/or |
4005 | a time. The specially formatted string carrying the date and time | |
a7808fba | 4006 | information is called a @emph{timestamp} in Org mode. This may be a |
dbc28aaa | 4007 | little confusing because timestamp is often used as indicating when |
a7808fba | 4008 | something was created or last changed. However, in Org mode this term |
dbc28aaa | 4009 | is 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 | ||
4028 | A time stamp is a specification of a date (possibly with time or a range | |
4029 | of 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 |
4031 | 12:00-12:30>}@footnote{This is the standard ISO date/time format. To |
4032 | use an alternative format, see @ref{Custom time format}.}. A time stamp | |
a7808fba | 4033 | can appear anywhere in the headline or body of an Org tree entry. Its |
dbc28aaa | 4034 | presence 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 |
4040 | A simple time stamp just assigns a date/time to an item. This is just | |
dbc28aaa CD |
4041 | like writing down an appointment or event in a paper agenda. In the |
4042 | timeline and agenda displays, the headline of an entry associated with a | |
4043 | plain 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 | |
4052 | A time stamp may contain a @emph{repeater interval}, indicating that it | |
4053 | applies not only on the given date, but again and again after a certain | |
4054 | interval of N days (d), weeks (w), months(m), or years(y). The | |
4055 | following 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 | 4062 | For more complex date specifications, Org mode supports using the |
4009494e GM |
4063 | special sexp diary entries implemented in the Emacs calendar/diary |
4064 | package. 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 | |
4074 | Two time stamps connected by @samp{--} denote a range. The headline | |
4075 | will be shown on the first and last day of the range, and on any dates | |
4076 | that 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 | |
4086 | Just like a plain time stamp, but with square brackets instead of | |
4087 | angular 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 | 4101 | For Org mode to recognize time stamps, they need to be in the specific |
4009494e GM |
4102 | format. All commands listed below produce time stamps in the correct |
4103 | format. | |
4104 | ||
4105 | @table @kbd | |
4106 | @kindex C-c . | |
4107 | @item C-c . | |
4108 | Prompt for a date and insert a corresponding time stamp. When the | |
4109 | cursor is at a previously used time stamp, it is updated to NOW. When | |
4110 | this 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 . | |
4114 | Like @kbd{C-c .}, but use the alternative format which contains date | |
4115 | and time. The default time can be rounded to multiples of 5 minutes, | |
4116 | see the option @code{org-time-stamp-rounding-minutes}. | |
4117 | @c | |
4118 | @kindex C-c ! | |
4119 | @item C-c ! | |
4120 | Like @kbd{C-c .}, but insert an inactive time stamp that will not cause | |
4121 | an agenda entry. | |
4122 | @c | |
4123 | @kindex C-c < | |
4124 | @item C-c < | |
4125 | Insert a time stamp corresponding to the cursor date in the Calendar. | |
4126 | @c | |
4127 | @kindex C-c > | |
4128 | @item C-c > | |
4129 | Access the Emacs calendar for the current date. If there is a | |
a7808fba | 4130 | timestamp in the current line, go to the corresponding date |
4009494e GM |
4131 | instead. |
4132 | @c | |
4133 | @kindex C-c C-o | |
4134 | @item C-c C-o | |
4135 | Access the agenda for the date given by the time stamp or -range at | |
a7808fba | 4136 | point (@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} | |
4142 | Change date at cursor by one day. These key bindings conflict with | |
a7808fba | 4143 | CUA 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} | |
4149 | Change the item under the cursor in a timestamp. The cursor can be on a | |
4150 | year, month, day, hour or minute. Note that if the cursor is in a | |
4151 | headline and not at a time stamp, these same keys modify the priority of | |
4152 | an item. (@pxref{Priorities}). The key bindings also conflict with | |
a7808fba | 4153 | CUA 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 |
4158 | Evaluate a time range by computing the difference between start and end. |
4159 | With a prefix argument, insert result after the time range (in a table: into | |
4160 | the 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 | 4174 | When Org mode prompts for a date/time, the default is shown as an ISO |
dbc28aaa CD |
4175 | date, and the prompt therefore seems to ask for an ISO date. But it |
4176 | will in fact accept any string containing some date and/or time | |
4177 | information, and it is really smart about interpreting your input. You | |
4178 | can, for example, use @kbd{C-y} to paste a (possibly multi-line) string | |
a7808fba | 4179 | copied from an email message. Org mode will find whatever information |
dbc28aaa CD |
4180 | is in there and derive anything you have not specified from the |
4181 | @emph{default date and time}. The default is usually the current date | |
4182 | and time, but when modifying an existing time stamp, or when entering | |
4183 | the second stamp of a range, it is taken from the stamp in the buffer. | |
a7808fba | 4184 | When filling in information, Org mode assumes that most of the time you |
dbc28aaa CD |
4185 | will want to enter a date in the future: If you omit the month/year and |
4186 | the given day/month is @i{before} today, it will assume that you mean a | |
4187 | future date@footnote{See the variable | |
4188 | @code{org-read-date-prefer-future}.}. | |
4189 | ||
4190 | For example, lets assume that today is @b{June 13, 2006}. Here is how | |
a7808fba | 4191 | various inputs will be interpreted, the items filled in by Org mode are |
dbc28aaa CD |
4192 | in @b{bold}. |
4193 | ||
4194 | @example | |
4195 | 3-2-5 --> 2003-02-05 | |
4196 | 14 --> @b{2006}-@b{06}-14 | |
4197 | 12 --> @b{2006}-@b{07}-12 | |
4198 | Fri --> nearest Friday (defaultdate or later) | |
4199 | sep 15 --> @b{2006}-11-15 | |
4200 | feb 15 --> @b{2007}-02-15 | |
4201 | sep 12 9 --> 2009-09-12 | |
4202 | 12:45 --> @b{2006}-@b{06}-@b{13} 12:45 | |
4203 | 22 sept 0:34 --> @b{2006}-09-22 0:34 | |
a7808fba CD |
4204 | w4 --> ISO week for of the current year @b{2006} |
4205 | 2012 w4 fri --> Friday of ISO week 4 in 2012 | |
4206 | 2012-w04-5 --> Same as above | |
dbc28aaa CD |
4207 | @end example |
4208 | ||
4209 | Furthermore 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 | |
4211 | letter [dwmy] to indicate change in days weeks, months, years. With a | |
4212 | single plus or minus, the date is always relative to today. With a | |
4213 | double plus or minus, it is relative to the default date. If instead of | |
4214 | a single letter, you use the abbreviation of day name, the date will be | |
4215 | the 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 | ||
4225 | The function understands English month and weekday abbreviations. If | |
4226 | you want to use unabbreviated names and/or other languages, configure | |
4227 | the variables @code{parse-time-months} and @code{parse-time-weekdays}. | |
4228 | ||
4229 | @cindex calendar, for selecting date | |
4230 | Parallel to the minibuffer prompt, a calendar is popped up@footnote{If | |
4231 | you don't need/want the calendar, configure the variable | |
4232 | @code{org-popup-calendar-for-date-prompt}.}. When you exit the date | |
4233 | prompt, 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 | |
4235 | information entered at the prompt. You can control the calendar fully | |
4236 | from 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.} | |
4250 | mouse-1 @r{Select date by clicking on it.} | |
4251 | S-@key{right}/@key{left} @r{One day forward/backward.} | |
4252 | S-@key{down}/@key{up} @r{One week forward/backward.} | |
4253 | M-S-@key{right}/@key{left} @r{One month forward/backward.} | |
4254 | @key{RET} @r{Choose date in calendar.} | |
4255 | @end example | |
4256 | ||
a7808fba CD |
4257 | The actions of the date/time prompt may seem complex, but I assure you they |
4258 | will grow on you, and you will start getting annoyed by pretty much any other | |
4259 | way of entering a date/time out there. To help you understand what is going | |
4260 | on, the current interpretation of your input will be displayed live in the | |
4261 | minibuffer@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 | 4270 | Org mode uses the standard ISO notation for dates and times as it is |
4009494e GM |
4271 | defined in ISO 8601. If you cannot get used to this and require another |
4272 | representation of date and time to keep you happy, you can get it by | |
4273 | customizing 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 | |
4279 | Toggle the display of custom formats for dates and times. | |
4280 | @end table | |
4281 | ||
4282 | @noindent | |
a7808fba | 4283 | Org mode needs the default format for scanning, so the custom date/time |
4009494e GM |
4284 | format does not @emph{replace} the default format - instead it is put |
4285 | @emph{over} the default format using text properties. This has the | |
4286 | following consequences: | |
4287 | @itemize @bullet | |
28a16a1b | 4288 | @item |
4009494e GM |
4289 | You cannot place the cursor onto a time stamp anymore, only before or |
4290 | after. | |
4291 | @item | |
4292 | The @kbd{S-@key{up}/@key{down}} keys can no longer be used to adjust | |
4293 | each component of a time stamp. If the cursor is at the beginning of | |
4294 | the stamp, @kbd{S-@key{up}/@key{down}} will change the stamp by one day, | |
4295 | just like @kbd{S-@key{left}/@key{right}}. At the end of the stamp, the | |
4296 | time will be changed by one minute. | |
4297 | @item | |
4298 | If the time stamp contains a range of clock times or a repeater, these | |
4299 | will not be overlayed, but remain in the buffer as they were. | |
4300 | @item | |
4301 | When you delete a time stamp character-by-character, it will only | |
4302 | disappear from the buffer after @emph{all} (invisible) characters | |
4303 | belonging to the ISO timestamp have been removed. | |
4304 | @item | |
4305 | If the custom time stamp format is longer than the default and you are | |
4306 | using dates in tables, table alignment will be messed up. If the custom | |
4307 | format 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 | 4314 | A 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 | |
4320 | Meaning: the task (most likely a TODO item, though not necessarily) is supposed | |
4321 | to be finished on that date. | |
4322 | ||
4323 | On the deadline date, the task will be listed in the agenda. In | |
4324 | addition, the agenda for @emph{today} will carry a warning about the | |
4325 | approaching or missed deadline, starting | |
4326 | @code{org-deadline-warning-days} before the due date, and continuing | |
4327 | until 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 | ||
4335 | You can specify a different lead time for warnings for a specific | |
4336 | deadlines using the following syntax. Here is an example with a warning | |
4337 | period of 5 days @code{DEADLINE: <2004-02-29 Sun -5d>}. | |
4338 | ||
4339 | @item SCHEDULED | |
4340 | @cindex SCHEDULED keyword | |
dbc28aaa CD |
4341 | |
4342 | Meaning: you are planning to start working on that task on the given | |
4343 | date. | |
4344 | ||
4345 | The headline will be listed under the given date@footnote{It will still | |
4346 | be listed on that date after it has been marked DONE. If you don't like | |
4009494e GM |
4347 | this, set the variable @code{org-agenda-skip-scheduled-if-done}.}. In |
4348 | addition, a reminder that the scheduled date has passed will be present | |
4349 | in the compilation for @emph{today}, until the entry is marked DONE. | |
4350 | I.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 |
4359 | understood in the same way that we understand @i{scheduling a meeting}. |
4360 | Setting a date for a meeting is just a simple appointment, you should | |
4361 | mark this entry with a simple plain time stamp, to get this item shown | |
4362 | on the date where it applies. This is a frequent mis-understanding from | |
a7808fba | 4363 | Org-users. In Org mode, @i{scheduling} means setting a date when you |
dbc28aaa | 4364 | want to start working on an action item. |
4009494e GM |
4365 | @end table |
4366 | ||
dbc28aaa | 4367 | You may use time stamps with repeaters in scheduling and deadline |
a7808fba | 4368 | entries. Org mode will issue early and late warnings based on the |
dbc28aaa CD |
4369 | assumption that the time stamp represents the @i{nearest instance} of |
4370 | the repeater. However, the use of diary sexp entries like | |
4371 | @c | |
4372 | @code{<%%(diary-float t 42)>} | |
4373 | @c | |
a7808fba | 4374 | in scheduling and deadline timestamps is limited. Org mode does not |
dbc28aaa CD |
4375 | know enough about the internals of each sexp function to issue early and |
4376 | late warnings. However, it will show the item on each day where the | |
4377 | sexp 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 | |
4387 | The following commands allow to quickly insert a deadline or to schedule | |
4388 | an item: | |
4389 | ||
4390 | @table @kbd | |
4391 | @c | |
4392 | @kindex C-c C-d | |
4393 | @item C-c C-d | |
4394 | Insert @samp{DEADLINE} keyword along with a stamp. The insertion will | |
dbc28aaa CD |
4395 | happen in the line directly following the headline. When called with a |
4396 | prefix 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 |
4402 | Create a sparse tree with all deadlines that are either past-due, or |
4403 | which will become due within @code{org-deadline-warning-days}. | |
4404 | With @kbd{C-u} prefix, show all deadlines in the file. With a numeric | |
dbc28aaa | 4405 | prefix, check that many days. For example, @kbd{C-1 C-c / d} shows |
4009494e GM |
4406 | all deadlines due tomorrow. |
4407 | @c | |
4408 | @kindex C-c C-s | |
4409 | @item C-c C-s | |
4410 | Insert @samp{SCHEDULED} keyword along with a stamp. The insertion will | |
4411 | happen in the line directly following the headline. Any CLOSED | |
dbc28aaa CD |
4412 | timestamp will be removed. When called with a prefix argument, remove |
4413 | the 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 | 4419 | Some tasks need to be repeated again and again. Org mode helps to |
28a16a1b CD |
4420 | organize such tasks using a so-called repeater in a DEADLINE, SCHEDULED, |
4421 | or 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 |
4426 | the @code{+1m} is a repeater; the intended interpretation is that the |
4427 | task has a deadline on <2005-10-01> and repeats itself every (one) month | |
28a16a1b CD |
4428 | starting from that time. If you need both a repeater and a special |
4429 | warning period in a deadline entry, the repeater comes first and the | |
4430 | warning period last: @code{DEADLINE: <2005-10-01 Sat +1m -3d>}. | |
4009494e GM |
4431 | |
4432 | Deadlines and scheduled items produce entries in the agenda when they | |
4433 | are over-due, so it is important to be able to mark such an entry as | |
4434 | completed once you have done so. When you mark a DEADLINE or a SCHEDULE | |
a7808fba | 4435 | with the TODO keyword DONE, it will no longer produce entries in the |
28a16a1b | 4436 | agenda. 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 |
4438 | deals with this in the following way: When you try to mark such an entry |
4439 | DONE (using @kbd{C-c C-t}), it will shift the base date of the repeating | |
4440 | time stamp by the repeater interval, and immediately set the entry state | |
4441 | back to TODO. In the example above, setting the state to DONE would | |
4442 | actually 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 |
4449 | A 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 | |
4452 | will aslo be prompted for a note.} will be added under the deadline, to keep | |
4453 | a record that you actually acted on the previous instance of this deadline. | |
4009494e GM |
4454 | |
4455 | As a consequence of shifting the base date, this entry will no longer be | |
4456 | visible in the agenda when checking past dates, but all future instances | |
4457 | will be visible. | |
4458 | ||
28a16a1b CD |
4459 | With the @samp{+1m} cookie, the date shift will always be exactly one |
4460 | month. So if you have not payed the rent for three months, marking this | |
4461 | entry DONE will still keep it as an overdue deadline. Depending on the | |
4462 | task, this may not be the best way to handle it. For example, if you | |
4463 | forgot to call you father for 3 weeks, it does not make sense to call | |
a7808fba | 4464 | him 3 times in a single day to make up for it. Finally, there are tasks |
28a16a1b | 4465 | like 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 |
4467 | special 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 |
4482 | You may have both scheduling and deadline information for a specific |
4483 | task - 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 | 4488 | Org mode allows you to clock the time you spent on specific tasks in a |
4009494e GM |
4489 | project. When you start working on an item, you can start the clock. |
4490 | When you stop working on that task, or when you mark the task done, the | |
4491 | clock is stopped and the corresponding time interval is recorded. It | |
4492 | also 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 | |
4497 | Start the clock on the current item (clock-in). This inserts the CLOCK | |
dbc28aaa CD |
4498 | keyword together with a timestamp. If this is not the first clocking of |
4499 | this 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, |
4502 | select the task from a list of recently clocked tasks. With two @kbd{C-u | |
4503 | C-u} prefixes, clock into the task at point and mark it as the default task. | |
4504 | The default task will always be available when selecting a clocking task, | |
4505 | with letter @kbd{d}. | |
4009494e GM |
4506 | @kindex C-c C-x C-o |
4507 | @item C-c C-x C-o | |
4508 | Stop the clock (clock-out). The inserts another timestamp at the same | |
4509 | location where the clock was last started. It also directly computes | |
4510 | the resulting time in inserts it after the time range as @samp{=> | |
28a16a1b CD |
4511 | HH:MM}. See the variable @code{org-log-note-clock-out} for the |
4512 | possibility to record an additional note together with the clock-out | |
4513 | time 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 | |
4517 | Recompute the time interval after changing one of the time stamps. This | |
4518 | is only necessary if you edit the time stamps directly. If you change | |
4519 | them with @kbd{S-@key{cursor}} keys, the update is automatic. | |
4520 | @kindex C-c C-t | |
4521 | @item C-c C-t | |
4522 | Changing the TODO state of an item to DONE automatically stops the clock | |
4523 | if it is running in this same item. | |
4524 | @kindex C-c C-x C-x | |
4525 | @item C-c C-x C-x | |
4526 | Cancel the current clock. This is useful if a clock was started by | |
4527 | mistake, 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 |
4530 | Jump 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 | |
4532 | tasks. | |
4009494e GM |
4533 | @kindex C-c C-x C-d |
4534 | @item C-c C-x C-d | |
4535 | Display time summaries for each subtree in the current buffer. This | |
4536 | puts overlays at the end of each headline, showing the total time | |
4537 | recorded under that heading, including the time of any subheadings. You | |
4538 | can use visibility cycling to study the tree, but the overlays disappear | |
4539 | when 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 | |
4543 | Insert a dynamic block (@pxref{Dynamic blocks}) containing a clock | |
a7808fba | 4544 | report as an Org mode table into the current file. When the cursor is |
dbc28aaa CD |
4545 | at an existing clock table, just update it. When called with a prefix |
4546 | argument, jump to the first clock report in the current document and | |
4547 | update 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 |
4553 | If such a block already exists at point, its content is replaced by the |
4554 | new 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 |
4586 | So to get a clock summary of the current level 1 tree, for the current |
4587 | day, 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 | |
4592 | and to use a specific time range you could write@footnote{Note that all | |
4593 | parameters must be specified in a single line - the line is broken here | |
4594 | only 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 | |
4604 | Update 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 | |
4608 | Update all dynamic blocks (@pxref{Dynamic blocks}). This is useful if | |
a7808fba CD |
4609 | you 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} | |
4614 | Shift the current @code{:block} interval and update the table. The cursor | |
4615 | needs 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 | ||
4619 | The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in | |
a7808fba | 4620 | the agenda (@pxref{Weekly/daily agenda}) to show which tasks have been |
4009494e GM |
4621 | worked on or closed during a day. |
4622 | ||
a7808fba CD |
4623 | @node Effort estimates |
4624 | @section Effort estimates | |
4625 | @cindex Effort estimates | |
4626 | ||
4627 | If you want to plan your work in a very detailed way, or if you need to | |
4628 | produce offers with quotations of the estimated work effort, you may want to | |
4629 | assign effort estimates to entries. If you are also clocking your work, you | |
4630 | may later want to compare the planned effort with the actual working time, a | |
4631 | great way to improve planning estimates. Effort estimates are stored in a | |
4632 | special property @samp{Effort}@footnote{You may change the property being | |
4633 | used with the variable @code{org-effort-property}.}. Clearly the best way to | |
4634 | work with effort estimates is through column view (@pxref{Column view}). You | |
4635 | should start by setting up discrete values for effort estimates, and a | |
4636 | @code{COLUMNS} format that displays these values together with clock sums (if | |
4637 | you 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 | |
4645 | or you can set up these values globally by customizing the variables | |
4646 | @code{org-global-properties} and @code{org-columns-default-format}. In | |
4647 | particular if you want to use this setup also in the agenda, a global setup | |
4648 | may be advised. | |
4649 | ||
4650 | The way to assign estimates to individual items is then to switch to column | |
4651 | mode, and to use @kbd{S-@key{right}} and @kbd{S-@key{left}} to change the | |
4652 | value. The values you enter will immediately be summed up in the hierarchy. | |
4653 | In the column next to it, any clocked time will be displayed. | |
4654 | ||
4655 | If you switch to column view in the daily/weekly agenda, the effort column | |
4656 | will summarize the estimated work effort for each day@footnote{Please note | |
4657 | the pitfalls of summing hierarchical data in a flat list (@pxref{Agenda | |
4658 | column view}.}, and you can use this to find space in your schedule. To get | |
4659 | an overview of the entire part of the day that is committed, you can set the | |
4660 | option @code{org-agenda-columns-add-appointments-to-effort-sum}. The | |
4661 | appointments on a day that take place over a specified time interval will | |
4662 | then 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 | ||
4668 | The @i{Remember} package by John Wiegley lets you store quick notes with | |
4669 | little interruption of your work flow. See | |
4670 | @uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more | |
4671 | information. It is an excellent way to add new notes and tasks to | |
a7808fba | 4672 | Org files. Org significantly expands the possibilities of |
dbc28aaa CD |
4673 | @i{remember}: You may define templates for different note types, and |
4674 | associate target files and headlines with specific templates. It also | |
4675 | allows you to select the location where a note should be stored | |
4676 | interactively, 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 | |
4688 | The following customization will tell @i{remember} to use org files as | |
a7808fba | 4689 | target, 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 | ||
4698 | The last line binds the command @code{org-remember} to a global | |
4699 | key@footnote{Please select your own key, @kbd{C-c r} is only a | |
4700 | suggestion.}. @code{org-remember} basically just calls @code{remember}, | |
4701 | but it makes a few things easier: If there is an active region, it will | |
4702 | automatically copy the region into the remember buffer. It also allows | |
4703 | to jump to the buffer and location where remember notes are being | |
28a16a1b | 4704 | stored: Just call @code{org-remember} with a prefix argument. If you |
a7808fba | 4705 | use two prefix arguments, Org jumps to the location where the last |
28a16a1b | 4706 | remember 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 | 4712 | In combination with Org, you can use templates to generate |
dbc28aaa CD |
4713 | different types of @i{remember} notes. For example, if you would like |
4714 | to use one template to create general TODO entries, another one for | |
4715 | journal entries, and a third one for collecting random ideas, you could | |
4716 | use: | |
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 | |
4726 | character specifies how to select the template. It is useful if the | |
4727 | character is also the first letter of the name. The next string | |
4728 | specifies the template. Two more (optional) strings give the file in | |
4729 | which, and the headline under which the new note should be stored. The | |
4730 | file (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 |
4733 | absolute path, it will be interpreted relative to @code{org-directory}. | |
dbc28aaa | 4734 | |
28a16a1b CD |
4735 | An optional sixth element specifies the contexts in which the user can |
4736 | select the template. This element can be either a list of major modes | |
4737 | or a function. @code{org-remember} will first check whether the function | |
a7808fba | 4738 | returns @code{t} or if we are in any of the listed major mode, and select |
28a16a1b CD |
4739 | the template accordingly. |
4740 | ||
4741 | So 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 | ||
4750 | The first template will only be available when invoking @code{org-remember} | |
4751 | from an buffer in @code{emacs-lisp-mode}. The second template will only be | |
4752 | available when the function @code{my-check} returns @code{t}. The third | |
4753 | template will be proposed in any context. | |
4754 | ||
dbc28aaa CD |
4755 | When you call @kbd{M-x remember} (or @kbd{M-x org-remember}) to remember |
4756 | something, org will prompt for a key to select the template (if you have | |
4757 | more 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 | |
4764 | During expansion of the template, special @kbd{%}-escapes allow dynamic | |
4765 | insertion 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 | |
4795 | For specific link types, the following keywords will be | |
4796 | defined@footnote{If you define your own link types (@pxref{Adding | |
4797 | hyperlink types}), any property you store with | |
4798 | @code{org-store-link-props} can be accessed in remember templates in a | |
4799 | similar way.}: | |
4800 | ||
4801 | @example | |
4802 | Link type | Available keywords | |
4803 | -------------------+---------------------------------------------- | |
4804 | bbdb | %:name %:company | |
28a16a1b | 4805 | bbdb | %::server %:port %:nick |
dbc28aaa CD |
4806 | vm, 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 |
4810 | gnus | %:group, @r{for messages also all email fields} |
4811 | w3, w3m | %:url | |
4812 | info | %:file %:node | |
4813 | calendar | %:date" | |
4814 | @end example | |
4815 | ||
4816 | @noindent | |
4817 | To 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 | 4824 | If 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 |
4826 | template that will be filled with the previous context information. | |
4827 | ||
4828 | @node Storing notes, Refiling notes, Remember templates, Remember | |
4829 | @section Storing notes | |
4830 | ||
4831 | When you are finished preparing a note with @i{remember}, you have to | |
4832 | press @kbd{C-c C-c} to file the note away. The handler will store the | |
4833 | note in the file and under the headline specified in the template, or it | |
4834 | will use the default file and headlines. The window configuration will | |
4835 | be 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}, | |
4838 | i.e. specify a double prefix argument to @kbd{C-c C-c}. | |
4839 | ||
4840 | If 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 | |
4842 | variable @code{org-remember-store-without-prompt} to make this behavior | |
4843 | the default.}. The handler will then first prompt for a target file - | |
4844 | if you press @key{RET}, the value specified for the template is used. | |
4845 | Then the command offers the headings tree of the selected file, with the | |
4846 | cursor position at the default headline (if you had specified one in the | |
4847 | template). You can either immediately press @key{RET} to get the note | |
4848 | placed there. Or you can use the following keys to find a different | |
4849 | location: | |
4850 | @example | |
4851 | @key{TAB} @r{Cycle visibility.} | |
4852 | @key{down} / @key{up} @r{Next/previous visible headline.} | |
4853 | n / p @r{Next/previous visible headline.} | |
4854 | f / b @r{Next/previous headline same level.} | |
4855 | u @r{One level up.} | |
4856 | @c 0-9 @r{Digit argument.} | |
4857 | @end example | |
4858 | @noindent | |
4859 | Pressing @key{RET} or @key{left} or @key{right} | |
4860 | then 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 | ||
4873 | Before inserting the text into a tree, the function ensures that the | |
4874 | text has a headline, i.e. a first line that starts with a @samp{*}. If | |
4875 | not, a headline is constructed from the current date and some additional | |
4876 | data. If you have indented the text of the note below the headline, the | |
4877 | indentation will be adapted if inserting the note into the tree requires | |
4878 | demotion from level 1. | |
4879 | ||
4880 | @node Refiling notes, , Storing notes, Remember | |
4881 | @section Refiling notes | |
4882 | @cindex refiling notes | |
4883 | ||
4884 | Remember is usually used to quickly capture notes and tasks into one or | |
4885 | a few capture lists. When reviewing the captured data, you may want to | |
4886 | refile some of the entries into a different list, for example into a | |
4887 | project. Cutting, finding the right location and then pasting the note | |
4888 | is cumbersome. To simplify this process, you can use the following | |
4889 | special command: | |
4890 | ||
4891 | @table @kbd | |
4892 | @kindex C-c C-w | |
4893 | @item C-c C-w | |
4894 | Refile the entry at point. This command offers possible locations for | |
4895 | refiling the entry and lets you select one with completion. The item is | |
4896 | filed 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 |
4898 | subitem.@* By default, all level 1 headlines in the current buffer are |
4899 | considered to be targets, but you can have more complex definitions | |
4900 | across a number of files. See the variable @code{org-refile-targets} | |
4901 | for details. | |
4902 | @kindex C-u C-c C-w | |
4903 | @item C-u C-c C-w | |
4904 | Use 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 | 4907 | Jump 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 | 4914 | Due to the way Org works, TODO items, time-stamped items, and |
4009494e | 4915 | tagged headlines can be scattered throughout a file or even a number of |
dbc28aaa CD |
4916 | files. To get an overview of open action items, or of events that are |
4917 | important for a particular date, this information must be collected, | |
4009494e GM |
4918 | sorted and displayed in an organized way. |
4919 | ||
a7808fba | 4920 | Org can select items based on various criteria, and display them |
28a16a1b | 4921 | in a separate buffer. Seven different view types are provided: |
4009494e GM |
4922 | |
4923 | @itemize @bullet | |
4924 | @item | |
4925 | an @emph{agenda} that is like a calendar and shows information | |
4926 | for specific dates, | |
4927 | @item | |
4928 | a @emph{TODO list} that covers all unfinished | |
4929 | action items, | |
4930 | @item | |
4931 | a @emph{tags view}, showings headlines based on | |
4932 | the tags associated with them, | |
4933 | @item | |
a7808fba | 4934 | a @emph{timeline view} that shows all events in a single Org file, |
4009494e GM |
4935 | in time-sorted view, |
4936 | @item | |
28a16a1b CD |
4937 | a @emph{keyword search view} that shows all entries from multiple files |
4938 | that contain specified keywords. | |
4939 | @item | |
4009494e GM |
4940 | a @emph{stuck projects view} showing projects that currently don't move |
4941 | along, and | |
4942 | @item | |
4943 | @emph{custom views} that are special tag/keyword searches and | |
4944 | combinations of different views. | |
4945 | @end itemize | |
4946 | ||
4947 | @noindent | |
4948 | The extracted information is displayed in a special @emph{agenda | |
4949 | buffer}. This buffer is read-only, but provides commands to visit the | |
a7808fba | 4950 | corresponding locations in the original Org files, and even to |
28a16a1b | 4951 | edit these files remotely. |
4009494e GM |
4952 | |
4953 | Two variables control how the agenda buffer is displayed and whether the | |
4954 | window 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 |
4973 | The information to be shown is normally collected from all @emph{agenda |
4974 | files}, the files listed in the variable | |
4975 | @code{org-agenda-files}@footnote{If the value of that variable is not a | |
4976 | list, but a single file name, then the list of agenda files will be | |
4977 | maintained in that external file.}. If a directory is part of this list, | |
4978 | all files with the extension @file{.org} in this directory will be part | |
4979 | of the list. | |
4980 | ||
a7808fba | 4981 | Thus even if you only work with a single Org file, this file should |
dbc28aaa CD |
4982 | be put into that list@footnote{When using the dispatcher, pressing |
4983 | @kbd{<} before selecting a command will actually limit the command to | |
4984 | the current file, and ignore @code{org-agenda-files} until the next | |
4009494e GM |
4985 | dispatcher command.}. You can customize @code{org-agenda-files}, but |
4986 | the 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 [ | |
4992 | Add current file to the list of agenda files. The file is added to | |
4993 | the front of the list. If it was already in the list, it is moved to | |
a7808fba | 4994 | the front. With a prefix argument, file is added/moved to the end. |
4009494e GM |
4995 | @kindex C-c ] |
4996 | @item C-c ] | |
4997 | Remove current file from the list of agenda files. | |
4998 | @kindex C-, | |
4999 | @kindex C-' | |
5000 | @item C-, | |
5001 | @itemx C-' | |
5002 | Cycle through agenda file list, visiting one file after the other. | |
a7808fba CD |
5003 | @kindex M-x org-iswitchb |
5004 | @item M-x org-iswitchb | |
5005 | Command to use an @code{iswitchb}-like interface to switch to and between Org | |
5006 | buffers. | |
4009494e GM |
5007 | @end table |
5008 | ||
5009 | @noindent | |
5010 | The Org menu contains the current list of files and can be used | |
5011 | to visit any of them. | |
5012 | ||
dbc28aaa CD |
5013 | If you would like to focus the agenda temporarily onto a file not in |
5014 | this list, or onto just one file in the list or even only a subtree in a | |
5015 | file, this can be done in different ways. For a single agenda command, | |
5016 | you may press @kbd{<} once or several times in the dispatcher | |
5017 | (@pxref{Agenda dispatcher}). To restrict the agenda scope for an | |
5018 | extended period, use the following commands: | |
5019 | ||
5020 | @table @kbd | |
5021 | @kindex C-c C-x < | |
5022 | @item C-c C-x < | |
5023 | Permanently restrict the agenda to the current subtree. When with a | |
5024 | prefix argument, or with the cursor before the first headline in a file, | |
5025 | the agenda scope is set to the entire file. This restriction remains in | |
5026 | effect until removed with @kbd{C-c C-x >}, or by typing either @kbd{<} | |
5027 | or @kbd{>} in the agenda dispatcher. If there is a window displaying an | |
5028 | agenda view, the new restriction takes effect immediately. | |
5029 | @kindex C-c C-x < | |
5030 | @item C-c C-x < | |
5031 | Remove the permanent restriction created by @kbd{C-c C-x <}. | |
5032 | @end table | |
5033 | ||
5034 | @noindent | |
5035 | When working with @file{Speedbar}, you can use the following commands in | |
a7808fba | 5036 | the Speedbar frame: |
dbc28aaa CD |
5037 | @table @kbd |
5038 | @kindex < | |
5039 | @item < @r{in the speedbar frame} | |
5040 | Permanently restrict the agenda to the item at the cursor in the | |
a7808fba | 5041 | Speedbar frame, either an Org file or a subtree in such a file. |
dbc28aaa CD |
5042 | If there is a window displaying an agenda view, the new restriction takes |
5043 | effect immediately. | |
5044 | @kindex < | |
5045 | @item > @r{in the speedbar frame} | |
5046 | Lift 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 | |
5053 | The views are created through a dispatcher that should be bound to a | |
5054 | global key, for example @kbd{C-c a} (@pxref{Installation}). In the | |
5055 | following we will assume that @kbd{C-c a} is indeed how the dispatcher | |
5056 | is accessed and list keyboard access to commands accordingly. After | |
5057 | pressing @kbd{C-c a}, an additional letter is required to execute a | |
5058 | command. The dispatcher offers the following default commands: | |
5059 | @table @kbd | |
5060 | @item a | |
a7808fba | 5061 | Create the calendar-like agenda (@pxref{Weekly/daily agenda}). |
4009494e GM |
5062 | @item t @r{/} T |
5063 | Create a list of all TODO items (@pxref{Global TODO list}). | |
5064 | @item m @r{/} M | |
5065 | Create a list of headlines matching a TAGS expression (@pxref{Matching | |
5066 | tags and properties}). | |
5067 | @item L | |
5068 | Create the timeline view for the current buffer (@pxref{Timeline}). | |
28a16a1b CD |
5069 | @item s |
5070 | Create a list of entries selected by a boolean expression of keywords | |
5071 | and/or regular expressions that must or must not occur in the entry. | |
dbc28aaa CD |
5072 | @item / |
5073 | Search for a regular expression in all agenda files and additionally in | |
5074 | the files listed in @code{org-agenda-multi-occur-extra-files}. This | |
5075 | uses the Emacs command @code{multi-occur}. A prefix argument can be | |
5076 | used to specify the number of context lines for each match, default is | |
5077 | 1. | |
28a16a1b CD |
5078 | @item # @r{/} ! |
5079 | Create a list of stuck projects (@pxref{Stuck projects}). | |
dbc28aaa CD |
5080 | @item < |
5081 | Restrict an agenda command to the current buffer@footnote{For backward | |
5082 | compatibility, you can also press @kbd{1} to restrict to the current | |
5083 | buffer.}. After pressing @kbd{<}, you still need to press the character | |
5084 | selecting the command. | |
5085 | @item < < | |
4009494e | 5086 | If there is an active region, restrict the following agenda command to |
dbc28aaa CD |
5087 | the region. Otherwise, restrict it to the current subtree@footnote{For |
5088 | backward compatibility, you can also press @kbd{0} to restrict to the | |
5089 | current buffer.}. After pressing @kbd{< <}, you still need to press the | |
5090 | character selecting the command. | |
4009494e GM |
5091 | @end table |
5092 | ||
5093 | You can also define custom commands that will be accessible through the | |
5094 | dispatcher, just like the default commands. This includes the | |
5095 | possibility to create extended agenda buffers that contain several | |
5096 | blocks together, for example the weekly agenda, the global TODO list and | |
5097 | a 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 | ||
5102 | In 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 | ||
5119 | The purpose of the weekly/daily @emph{agenda} is to act like a page of a | |
5120 | paper 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 | |
5126 | Compile an agenda for the current week from a list of org files. The | |
dbc28aaa CD |
5127 | agenda shows the entries for each day. With a numeric |
5128 | prefix@footnote{For backward compatibility, the universal prefix | |
5129 | @kbd{C-u} causes all TODO entries to be listed before the agenda. This | |
5130 | feature is deprecated, use the dedicated TODO list, or a block agenda | |
5131 | instead.} (like @kbd{C-u 2 1 C-c a a}) you may set the number of days | |
5132 | to be displayed (see also the variable @code{org-agenda-ndays}) | |
4009494e GM |
5133 | @end table |
5134 | ||
5135 | Remote editing from the agenda buffer means, for example, that you can | |
5136 | change the dates of deadlines and appointments from the agenda buffer. | |
5137 | The commands available in the Agenda buffer are listed in @ref{Agenda | |
5138 | commands}. | |
5139 | ||
5140 | @subsubheading Calendar/Diary integration | |
5141 | @cindex calendar integration | |
5142 | @cindex diary integration | |
5143 | ||
5144 | Emacs contains the calendar and diary by Edward M. Reingold. The | |
5145 | calendar displays a three-month calendar with holidays from different | |
5146 | countries and cultures. The diary allows you to keep track of | |
5147 | anniversaries, lunar phases, sunrise/set, recurrent appointments | |
5148 | (weekly, monthly) and more. In this way, it is quite complementary to | |
a7808fba | 5149 | Org. It can be very useful to combine output from Org with |
4009494e GM |
5150 | the diary. |
5151 | ||
a7808fba | 5152 | In order to include entries from the Emacs diary into Org mode's |
4009494e GM |
5153 | agenda, 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 | |
5160 | entries including holidays, anniversaries etc will be included in the | |
a7808fba | 5161 | agenda 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 |
5163 | file in order to edit existing diary entries. The @kbd{i} command to | |
5164 | insert new entries for the current date works in the agenda buffer, as | |
5165 | well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display | |
5166 | Sunrise/Sunset times, show lunar phases and to convert to other | |
5167 | calendars, respectively. @kbd{c} can be used to switch back and forth | |
5168 | between calendar and agenda. | |
5169 | ||
5170 | If you are using the diary only for sexp entries and holidays, it is | |
5171 | faster to not use the above setting, but instead to copy or even move | |
a7808fba | 5172 | the entries into an Org file. Org mode evaluates diary-style sexp |
4009494e GM |
5173 | entries, and does it faster because there is no overhead for first |
5174 | creating the diary display. Note that the sexp entries must start at | |
5175 | the left margin, no white space is allowed before them. For example, | |
a7808fba | 5176 | the following segment of an Org file will be processed and entries |
4009494e GM |
5177 | will 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 | ||
5192 | Org can interact with Emacs appointments notification facility. | |
5193 | ||
5194 | To add all the appointments of your agenda files, use the command | |
5195 | @code{org-agenda-to-appt}. This commands also lets you filter through | |
5196 | the list of your appointments and add only those belonging to a specific | |
5197 | category or matching a regular expression. See the docstring for | |
5198 | details. | |
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 | ||
5205 | The global TODO list contains all unfinished TODO items, formatted and | |
5206 | collected into a single place. | |
5207 | ||
5208 | @table @kbd | |
5209 | @kindex C-c a t | |
5210 | @item C-c a t | |
5211 | Show the global TODO list. This collects the TODO items from all | |
a7808fba | 5212 | agenda 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 |
5214 | the 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 | |
5218 | Like the above, but allows selection of a specific TODO keyword. You | |
5219 | can also do this by specifying a prefix argument to @kbd{C-c a t}. With | |
5220 | a @kbd{C-u} prefix you are prompted for a keyword, and you may also | |
5221 | specify several keywords by separating them with @samp{|} as boolean OR | |
5222 | operator. With a numeric prefix, the Nth keyword in | |
5223 | @code{org-todo-keywords} is selected. | |
5224 | @kindex r | |
5225 | The @kbd{r} key in the agenda buffer regenerates it, and you can give | |
5226 | a prefix argument to this command to change the selected TODO keyword, | |
5227 | for example @kbd{3 r}. If you often need a search for a specific | |
5228 | keyword, define a custom command for it (@pxref{Agenda dispatcher}).@* | |
5229 | Matching specific TODO keywords can also be done as part of a tags | |
5230 | search (@pxref{Tag searches}). | |
5231 | @end table | |
5232 | ||
5233 | Remote editing of TODO items means that you can change the state of a | |
5234 | TODO entry with a single key press. The commands available in the | |
5235 | TODO list are described in @ref{Agenda commands}. | |
5236 | ||
a7808fba CD |
5237 | @cindex sublevels, inclusion into TODO list |
5238 | Normally the global TODO list simply shows all headlines with TODO | |
4009494e GM |
5239 | keywords. This list can become very long. There are two ways to keep |
5240 | it more compact: | |
5241 | @itemize @minus | |
5242 | @item | |
5243 | Some people view a TODO item that has been @emph{scheduled} for | |
a7808fba | 5244 | execution (@pxref{Timestamps}) as no longer @emph{open}. Configure the |
4009494e GM |
5245 | variable @code{org-agenda-todo-ignore-scheduled} to exclude scheduled |
5246 | items from the global TODO list. | |
5247 | @item | |
5248 | TODO items may have sublevels to break up the task into subtasks. In | |
5249 | such cases it may be enough to list only the highest level TODO headline | |
5250 | and 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 | ||
5260 | If headlines in the agenda files are marked with @emph{tags} | |
5261 | (@pxref{Tags}), you can select headlines based on the tags that apply | |
5262 | to them and collect them into an agenda buffer. | |
5263 | ||
5264 | @table @kbd | |
5265 | @kindex C-c a m | |
5266 | @item C-c a m | |
5267 | Produce a list of all headlines that match a given set of tags. The | |
5268 | command prompts for a selection criterion, which is a boolean logic | |
dbc28aaa CD |
5269 | expression with tags, like @samp{+work+urgent-withboss} or |
5270 | @samp{work|home} (@pxref{Tags}). If you often need a specific search, | |
4009494e GM |
5271 | define a custom command for it (@pxref{Agenda dispatcher}). |
5272 | @kindex C-c a M | |
5273 | @item C-c a M | |
5274 | Like @kbd{C-c a m}, but only select headlines that are also TODO items | |
5275 | and force checking subitems (see variable | |
a7808fba | 5276 | @code{org-tags-match-list-sublevels}). Matching specific TODO keywords |
4009494e GM |
5277 | together with a tags match is also possible, see @ref{Tag searches}. |
5278 | @end table | |
5279 | ||
5280 | The commands available in the tags list are described in @ref{Agenda | |
5281 | commands}. | |
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 | 5288 | The timeline summarizes all time-stamped items from a single Org mode |
4009494e GM |
5289 | file in a @emph{time-sorted view}. The main purpose of this command is |
5290 | to give an overview over events in a project. | |
5291 | ||
5292 | @table @kbd | |
5293 | @kindex C-c a L | |
5294 | @item C-c a L | |
5295 | Show a time-sorted view of the org file, with all time-stamped items. | |
5296 | When 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 | |
5301 | The 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 | 5309 | This agenda view is a general text search facility for Org mode entries. |
28a16a1b CD |
5310 | It is particularly useful to find notes. |
5311 | ||
5312 | @table @kbd | |
5313 | @kindex C-c a s | |
5314 | @item C-c a s | |
5315 | This is a special search that lets you select entries by keywords or | |
5316 | regular expression, using a boolean logic. For example, the search | |
5317 | string | |
5318 | ||
5319 | @example | |
5320 | +computer +wifi -ethernet -@{8\.11[bg]@} | |
5321 | @end example | |
4009494e | 5322 | |
28a16a1b CD |
5323 | @noindent |
5324 | will search for note entries that contain the keywords @code{computer} | |
5325 | and @code{wifi}, but not the keyword @code{ethernet}, and which are also | |
5326 | not matched by the regular expression @code{8\.11[bg]}, meaning to | |
5327 | exclude both 8.11b and 8.11g. | |
5328 | ||
5329 | Note that in addition to the agenda files, this command will also search | |
5330 | the 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 | ||
5336 | If you are following a system like David Allen's GTD to organize your | |
5337 | work, one of the ``duties'' you have is a regular review to make sure | |
5338 | that all projects move along. A @emph{stuck} project is a project that | |
5339 | has no defined next actions, so it will never show up in the TODO lists | |
a7808fba | 5340 | Org mode produces. During the review, you need to identify such |
4009494e GM |
5341 | projects and define next actions for them. |
5342 | ||
5343 | @table @kbd | |
5344 | @kindex C-c a # | |
5345 | @item C-c a # | |
5346 | List projects that are stuck. | |
5347 | @kindex C-c a ! | |
5348 | @item C-c a ! | |
5349 | Customize the variable @code{org-stuck-projects} to define what a stuck | |
5350 | project is and how to find it. | |
5351 | @end table | |
5352 | ||
5353 | You almost certainly will have to configure this view before it will | |
5354 | work for you. The built-in default assumes that all your projects are | |
5355 | level-2 headlines, and that a project is not stuck if it has at least | |
a7808fba | 5356 | one entry marked with a TODO keyword TODO or NEXT or NEXTACTION. |
4009494e | 5357 | |
a7808fba CD |
5358 | Lets assume that you, in your own way of using Org mode, identify |
5359 | projects with a tag PROJECT, and that you use a TODO keyword MAYBE to | |
4009494e | 5360 | indicate a project that should not be considered yet. Lets further |
a7808fba | 5361 | assume that the TODO keyword DONE marks finished projects, and that NEXT |
4009494e GM |
5362 | and TODO indicate next actions. The tag @@SHOP indicates shopping and |
5363 | is a next action even without the NEXT tag. Finally, if the project | |
5364 | contains the special word IGNORE anywhere, it should not be listed | |
5365 | either. In this case you would start by identifying eligible projects | |
5366 | with a tags/todo match @samp{+PROJECT/-MAYBE-DONE}, and then check for | |
5367 | TODO, NEXT, @@SHOP, and IGNORE in the subtree to identify projects that | |
5368 | are 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 | 5381 | Before displaying items in an agenda view, Org mode visually prepares |
4009494e GM |
5382 | the items and sorts them. Each item occupies a single line. The line |
5383 | starts with a @emph{prefix} that contains the @emph{category} | |
5384 | (@pxref{Categories}) of the item and other important information. You can | |
5385 | customize the prefix using the option @code{org-agenda-prefix-format}. | |
5386 | The prefix is followed by a cleaned-up version of the outline headline | |
5387 | associated 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 | |
5399 | The category is a broad label assigned to each agenda item. By default, | |
5400 | the category is simply derived from the file name, but you can also | |
dbc28aaa CD |
5401 | specify it with a special line in the buffer, like this@footnote{For |
5402 | backward compatibility, the following also works: If there are several | |
5403 | such lines in a file, each specifies the category for the text below it. | |
5404 | The first category also applies to any text before the first CATEGORY | |
5405 | line. However, using this method is @emph{strongly} deprecated as it is | |
5406 | incompatible with the outline structure of the document. The correct | |
5407 | method for setting multiple categories in a buffer is using a | |
5408 | property.}: | |
4009494e GM |
5409 | |
5410 | @example | |
5411 | #+CATEGORY: Thesis | |
5412 | @end example | |
5413 | ||
dbc28aaa CD |
5414 | @noindent |
5415 | If 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 | 5417 | as the value (@pxref{Properties and Columns}). |
dbc28aaa CD |
5418 | |
5419 | @noindent | |
5420 | The display in the agenda buffer looks best if the category is not | |
5421 | longer 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 | 5427 | Org mode checks each agenda item for a time-of-day specification. The |
4009494e GM |
5428 | time can be part of the time stamp that triggered inclusion into the |
5429 | agenda, for example as in @w{@samp{<2005-05-10 Tue 19:00>}}. Time | |
5430 | ranges 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 | ||
5434 | In the headline of the entry itself, a time(range) may also appear as | |
5435 | plain text (like @samp{12:45} or a @samp{8:30-1pm}. If the agenda | |
a7808fba | 5436 | integrates the Emacs diary (@pxref{Weekly/daily agenda}), time |
4009494e GM |
5437 | specifications in diary entries are recognized as well. |
5438 | ||
a7808fba | 5439 | For agenda display, Org mode extracts the time and displays it in a |
4009494e GM |
5440 | standard 24 hour format as part of the prefix. The example times in |
5441 | the 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 | |
5451 | If the agenda is in single-day mode, or for the display of today, the | |
5452 | timed 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 | ||
5468 | The 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 | |
5476 | Before being inserted into a view, the items are sorted. How this is | |
5477 | done depends on the type of view. | |
5478 | @itemize @bullet | |
5479 | @item | |
5480 | For the daily/weekly agenda, the items for each day are sorted. The | |
5481 | default order is to first collect all items containing an explicit | |
5482 | time-of-day specification. These entries will be shown at the beginning | |
5483 | of the list, as a @emph{schedule} for the day. After that, items remain | |
5484 | grouped in categories, in the sequence given by @code{org-agenda-files}. | |
5485 | Within each category, items are sorted by priority (@pxref{Priorities}), | |
5486 | which is composed of the base priority (2000 for priority @samp{A}, 1000 | |
5487 | for @samp{B}, and 0 for @samp{C}), plus additional increments for | |
5488 | overdue scheduled or deadline items. | |
28a16a1b | 5489 | @item |
4009494e GM |
5490 | For the TODO list, items remain in the order of categories, but within |
5491 | each category, sorting takes place according to priority | |
5492 | (@pxref{Priorities}). | |
5493 | @item | |
5494 | For tags matches, items are not sorted at all, but just appear in the | |
5495 | sequence in which they are found in the agenda files. | |
5496 | @end itemize | |
5497 | ||
5498 | Sorting can be customized using the variable | |
a7808fba CD |
5499 | @code{org-agenda-sorting-strategy}, and may also include criteria based on |
5500 | the 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 | ||
5508 | Entries in the agenda buffer are linked back to the org file or diary | |
5509 | file where they originate. You are not allowed to edit the agenda | |
5510 | buffer itself, but commands are provided to show and jump to the | |
5511 | original entry location, and to edit the org-files ``remotely'' from | |
5512 | the agenda buffer. In this way, all information is stored only once, | |
5513 | removing the risk that your agenda and note files may diverge. | |
5514 | ||
5515 | Some commands can be executed with mouse clicks on agenda lines. For | |
5516 | the 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 | 5523 | Next line (same as @key{up} and @kbd{C-p}). |
4009494e GM |
5524 | @kindex p |
5525 | @item p | |
dbc28aaa | 5526 | Previous 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} | |
5532 | Display the original location of the item in another window. | |
5533 | @c | |
5534 | @kindex L | |
5535 | @item L | |
5536 | Display 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} | |
5544 | Go to the original location of the item in another window. Under Emacs | |
5545 | 22, @kbd{mouse-1} will also works for this. | |
5546 | @c | |
5547 | @kindex @key{RET} | |
5548 | @itemx @key{RET} | |
5549 | Go to the original location of the item and delete other windows. | |
5550 | @c | |
5551 | @kindex f | |
5552 | @item f | |
5553 | Toggle Follow mode. In Follow mode, as you move the cursor through | |
5554 | the agenda buffer, the other window always shows the corresponding | |
5555 | location in the org file. The initial setting for this mode in new | |
5556 | agenda 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 |
5561 | Display the entire subtree of the current item in an indirect buffer. With a |
5562 | numeric prefix argument N, go up to level N and then take that tree. If N is | |
5563 | negative, go up that many levels. With a @kbd{C-u} prefix, do not remove the | |
5564 | previously used indirect buffer. | |
4009494e GM |
5565 | @c |
5566 | @kindex l | |
5567 | @item l | |
5568 | Toggle Logbook mode. In Logbook mode, entries that where marked DONE while | |
5569 | logging was on (variable @code{org-log-done}) are shown in the agenda, | |
5570 | as are entries that have been clocked on that day. | |
a7808fba CD |
5571 | @c |
5572 | @kindex R | |
5573 | @item R | |
5574 | Toggle Clockreport mode. In clockreport mode, the daily/weekly agenda will | |
5575 | always show a table with the clocked times for the timespan and file scope | |
5576 | covered by the current agenda view. The initial setting for this mode in new | |
5577 | agenda 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 | |
5584 | Delete other windows. | |
5585 | @c | |
5586 | @kindex d | |
5587 | @kindex w | |
5588 | @kindex m | |
5589 | @kindex y | |
5590 | @item d w m y | |
5591 | Switch to day/week/month/year view. When switching to day or week view, | |
a7808fba CD |
5592 | this setting becomes the default for subsequent agenda commands. Since |
5593 | month and year views are slow to create, they do not become the default. | |
5594 | A numeric prefix argument may be used to jump directly to a specific day | |
5595 | of 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 | |
5597 | setting day, week, or month view, a year may be encoded in the prefix | |
5598 | argument as well. For example, @kbd{200712 w} will jump to week 12 in | |
5599 | 2007. If such a year specification has only one or two digits, it will | |
5600 | be mapped to the interval 1938-2037. | |
4009494e GM |
5601 | @c |
5602 | @kindex D | |
5603 | @item D | |
a7808fba | 5604 | Toggle the inclusion of diary entries. See @ref{Weekly/daily agenda}. |
4009494e | 5605 | @c |
28a16a1b CD |
5606 | @kindex G |
5607 | @item G | |
4009494e GM |
5608 | Toggle 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 | |
5613 | Recreate the agenda buffer, for example to reflect the changes | |
5614 | after modification of the time stamps of items with S-@key{left} and | |
a7808fba | 5615 | S-@key{right}. When the buffer is the global TODO list, a prefix |
4009494e GM |
5616 | argument is interpreted to create a selective list for a specific TODO |
5617 | keyword. | |
28a16a1b CD |
5618 | @kindex g |
5619 | @item g | |
5620 | Same 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 | 5626 | Save all Org buffers in the current Emacs session. |
4009494e GM |
5627 | @c |
5628 | @kindex @key{right} | |
5629 | @item @key{right} | |
5630 | Display the following @code{org-agenda-ndays} days. For example, if | |
5631 | the display covers a week, switch to the following week. With prefix | |
5632 | arg, go forward that many times @code{org-agenda-ndays} days. | |
5633 | @c | |
5634 | @kindex @key{left} | |
5635 | @item @key{left} | |
5636 | Display the previous dates. | |
5637 | @c | |
5638 | @kindex . | |
5639 | @item . | |
a7808fba CD |
5640 | Go to today. |
5641 | @c | |
5642 | @kindex C-c C-x C-c | |
5643 | @item C-c C-x C-c | |
5644 | Invoke column view (@pxref{Column view}) in the agenda buffer. The column | |
5645 | view format is taken from the entry at point, or (if there is no entry at | |
5646 | point), from the first entry in the agenda view. So whatever the format for | |
5647 | that 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 [ ] @{ @} | |
5659 | In the @i{search view} (@pxref{Keyword search}), these keys add new | |
5660 | search words (@kbd{[} and @kbd{]}) or new regular expressions (@kbd{@{} | |
5661 | and @kbd{@}}) to the query string. The opening bracket/brace will add a | |
5662 | positive search term prefixed by @samp{+}, indicating that this search | |
5663 | term @i{must} occur/match in the entry. Closing bracket/brace add a | |
5664 | negative search term which @i{must not} occur/match in the entry for it | |
5665 | to be selected. | |
5666 | ||
5667 | ||
4009494e GM |
5668 | @tsubheading{Remote editing} |
5669 | @cindex remote editing, from agenda | |
5670 | ||
5671 | @item 0-9 | |
5672 | Digit argument. | |
5673 | @c | |
5674 | @cindex undoing remote-editing events | |
5675 | @cindex remote editing, undo | |
5676 | @kindex C-_ | |
5677 | @item C-_ | |
5678 | Undo a change due to a remote editing command. The change is undone | |
5679 | both in the agenda buffer and in the remote buffer. | |
5680 | @c | |
5681 | @kindex t | |
5682 | @item t | |
5683 | Change the TODO state of the item, both in the agenda and in the | |
5684 | original org file. | |
5685 | @c | |
5686 | @kindex C-k | |
5687 | @item C-k | |
5688 | Delete the current agenda item along with the entire subtree belonging | |
a7808fba | 5689 | to it in the original Org file. If the text to be deleted remotely |
4009494e GM |
5690 | is longer than one line, the kill needs to be confirmed by the user. See |
5691 | variable @code{org-agenda-confirm-kill}. | |
5692 | @c | |
a7808fba CD |
5693 | @kindex a |
5694 | @item a | |
5695 | Toggle the ARCHIVE tag for the current headline. | |
5696 | @c | |
5697 | @kindex A | |
5698 | @item A | |
5699 | Move the subtree correspoding to the current entry to its @emph{Archive | |
5700 | Sibling}. | |
5701 | @c | |
4009494e GM |
5702 | @kindex $ |
5703 | @item $ | |
a7808fba CD |
5704 | Archive the subtree corresponding to the current headline. This means the |
5705 | entry will be moved to the configured archive locatin, most likely a | |
5706 | different file. | |
4009494e GM |
5707 | @c |
5708 | @kindex T | |
5709 | @item T | |
5710 | Show all tags associated with the current item. Because of | |
5711 | inheritance, this may be more than the tags listed in the line itself. | |
5712 | @c | |
5713 | @kindex : | |
5714 | @item : | |
dbc28aaa CD |
5715 | Set tags for the current headline. If there is an active region in the |
5716 | agenda, change a tag for all headings in the region. | |
4009494e | 5717 | @c |
4009494e GM |
5718 | @kindex , |
5719 | @item , | |
a7808fba | 5720 | Set the priority for the current item. Org mode prompts for the |
4009494e GM |
5721 | priority character. If you reply with @key{SPC}, the priority cookie |
5722 | is removed from the entry. | |
5723 | @c | |
5724 | @kindex P | |
5725 | @item P | |
5726 | Display weighted priority of current item. | |
5727 | @c | |
5728 | @kindex + | |
5729 | @kindex S-@key{up} | |
5730 | @item + | |
5731 | @itemx S-@key{up} | |
5732 | Increase the priority of the current item. The priority is changed in | |
5733 | the original buffer, but the agenda is not resorted. Use the @kbd{r} | |
5734 | key for this. | |
5735 | @c | |
5736 | @kindex - | |
5737 | @kindex S-@key{down} | |
5738 | @item - | |
5739 | @itemx S-@key{down} | |
5740 | Decrease the priority of the current item. | |
5741 | @c | |
5742 | @kindex C-c C-s | |
5743 | @item C-c C-s | |
5744 | Schedule this item | |
5745 | @c | |
5746 | @kindex C-c C-d | |
5747 | @item C-c C-d | |
5748 | Set a deadline for this item. | |
5749 | @c | |
5750 | @kindex S-@key{right} | |
5751 | @item S-@key{right} | |
a7808fba CD |
5752 | Change the time stamp associated with the current line by one day into the |
5753 | future. With a numeric prefix argument, change it by that many days. For | |
5754 | example, @kbd{3 6 5 S-@key{right}} will change it by a year. The stamp is | |
5755 | changed in the original org file, but the change is not directly reflected in | |
5756 | the 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} | |
5760 | Change the time stamp associated with the current line by one day | |
5761 | into the past. | |
5762 | @c | |
5763 | @kindex > | |
5764 | @item > | |
5765 | Change the time stamp associated with the current line to today. | |
5766 | The key @kbd{>} has been chosen, because it is the same as @kbd{S-.} | |
5767 | on my keyboard. | |
5768 | @c | |
5769 | @kindex I | |
5770 | @item I | |
5771 | Start the clock on the current item. If a clock is running already, it | |
5772 | is stopped first. | |
5773 | @c | |
5774 | @kindex O | |
5775 | @item O | |
5776 | Stop the previously started clock. | |
5777 | @c | |
5778 | @kindex X | |
5779 | @item X | |
5780 | Cancel the currently running clock. | |
5781 | ||
dbc28aaa CD |
5782 | @kindex J |
5783 | @item J | |
5784 | Jump 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 | |
5790 | Open the Emacs calendar and move to the date at the agenda cursor. | |
5791 | @c | |
5792 | @item c | |
a7808fba | 5793 | When in the calendar, compute and show the Org mode agenda for the |
4009494e GM |
5794 | date at the cursor. |
5795 | @c | |
5796 | @cindex diary entries, creating from agenda | |
5797 | @kindex i | |
5798 | @item i | |
5799 | Insert a new entry into the diary. Prompts for the type of entry | |
5800 | (day, weekly, monthly, yearly, anniversary, cyclic) and creates a new | |
5801 | entry in the diary, just as @kbd{i d} etc. would do in the calendar. | |
5802 | The date is taken from the cursor position. | |
5803 | @c | |
5804 | @kindex M | |
5805 | @item M | |
5806 | Show the phases of the moon for the three months around current date. | |
5807 | @c | |
5808 | @kindex S | |
5809 | @item S | |
5810 | Show sunrise and sunset times. The geographical location must be set | |
5811 | with calendar variables, see documentation of the Emacs calendar. | |
5812 | @c | |
5813 | @kindex C | |
5814 | @item C | |
5815 | Convert the date at cursor into many other cultural and historic | |
5816 | calendars. | |
5817 | @c | |
5818 | @kindex H | |
5819 | @item H | |
5820 | Show holidays for three month around the cursor date. | |
a7808fba CD |
5821 | |
5822 | @item M-x org-export-icalendar-combine-agenda-files | |
4009494e | 5823 | Export a single iCalendar file containing entries from all agenda files. |
a7808fba | 5824 | This 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 | |
5831 | Write the agenda view to a file. Depending on the extension of the | |
5832 | selected file name, the view will be exported as HTML (extension | |
5833 | @file{.html} or @file{.htm}), Postscript (extension @file{.ps}), or | |
5834 | plain text (any other extension). Use the variable | |
5835 | @code{org-agenda-exporter-settings} to set options for @file{ps-print} | |
5836 | and for @file{htmlize} to be used during export. | |
5837 | ||
5838 | @tsubheading{Quit and Exit} | |
5839 | @kindex q | |
5840 | @item q | |
5841 | Quit agenda, remove the agenda buffer. | |
5842 | @c | |
5843 | @kindex x | |
5844 | @cindex agenda files, removing buffers | |
5845 | @item x | |
5846 | Exit agenda, remove the agenda buffer and all buffers loaded by Emacs | |
5847 | for the compilation of the agenda. Buffers created by the user to | |
5848 | visit 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 | ||
5857 | Custom agenda commands serve two purposes: to store and quickly access | |
5858 | frequently used TODO and tags searches, and to create special composite | |
5859 | agenda buffers. Custom agenda commands will be accessible through the | |
5860 | dispatcher (@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 | ||
5873 | The first application of custom searches is the definition of keyboard | |
5874 | shortcuts for frequently used searches, either creating an agenda | |
5875 | buffer, or a sparse tree (the latter covering of course only the current | |
5876 | buffer). | |
5877 | @kindex C-c a C | |
5878 | Custom commands are configured in the variable | |
5879 | @code{org-agenda-custom-commands}. You can customize this variable, for | |
5880 | example by pressing @kbd{C-c a C}. You can also directly set it with | |
5881 | Emacs Lisp in @file{.emacs}. The following example contains all valid | |
5882 | search 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 |
5901 | The initial string in each entry defines the keys you have to press |
5902 | after the dispatcher command @kbd{C-c a} in order to access the command. | |
5903 | Usually this will be just a single character, but if you have many | |
5904 | similar commands, you can also define two-letter combinations where the | |
5905 | first character is the same in several combinations and serves as a | |
5906 | prefix key@footnote{You can provide a description for a prefix key by | |
5907 | inserting a cons cell with the prefix and the description.}. The second | |
5908 | parameter is the search type, followed by the string or regular | |
5909 | expression to be used for the matching. The example above will | |
5910 | therefore define: | |
4009494e GM |
5911 | |
5912 | @table @kbd | |
5913 | @item C-c a w | |
5914 | as a global search for TODO entries with @samp{WAITING} as the TODO | |
5915 | keyword | |
5916 | @item C-c a W | |
5917 | as the same search, but only in the current buffer and displaying the | |
5918 | results as a sparse tree | |
5919 | @item C-c a u | |
dbc28aaa CD |
5920 | as a global tags search for headlines marked @samp{:boss:} but not |
5921 | @samp{:urgent:} | |
4009494e GM |
5922 | @item C-c a v |
5923 | as the same search as @kbd{C-c a u}, but limiting the search to | |
5924 | headlines that are also TODO items | |
5925 | @item C-c a U | |
5926 | as the same search as @kbd{C-c a u}, but only in the current buffer and | |
5927 | displaying the result as a sparse tree | |
5928 | @item C-c a f | |
5929 | to create a sparse tree (again: current buffer only) with all entries | |
dbc28aaa CD |
5930 | containing the word @samp{FIXME} |
5931 | @item C-c a h | |
5932 | as a prefix command for a HOME tags search where you have to press an | |
5933 | additional key (@kbd{l}, @kbd{p} or @kbd{k}) to select a name (Lisa, | |
5934 | Peter, 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 | ||
5942 | Another possibility is the construction of agenda views that comprise | |
5943 | the results of @emph{several} commands, each of which creates a block in | |
5944 | the agenda buffer. The available commands include @code{agenda} for the | |
5945 | daily or weekly agenda (as created with @kbd{C-c a a}), @code{alltodo} | |
a7808fba | 5946 | for the global TODO list (as constructed with @kbd{C-c a t}), and the |
4009494e GM |
5947 | matching 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 | |
5965 | This will define @kbd{C-c a h} to create a multi-block view for stuff | |
5966 | you need to attend to at home. The resulting agenda buffer will contain | |
5967 | your 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 |
5969 | command @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 | 5975 | Org mode contains a number of variables regulating agenda construction |
4009494e GM |
5976 | and display. The global variables define the behavior for all agenda |
5977 | commands, including the custom commands. However, if you want to change | |
5978 | some settings just for a single custom view, you can do so. Setting | |
5979 | options requires inserting a list of variable names and values at the | |
5980 | right 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 | |
5998 | Now the @kbd{C-c a w} command will sort the collected entries only by | |
dbc28aaa | 5999 | priority, and the prefix format is modified to just say @samp{ Mixed: } |
4009494e GM |
6000 | instead 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 | |
6002 | headline hierarchy above the match, nor the headline following the match | |
28a16a1b CD |
6003 | will be shown. The command @kbd{C-c a N} will do a text search limited |
6004 | to only a single file. | |
4009494e GM |
6005 | |
6006 | For command sets creating a block agenda, | |
6007 | @code{org-agenda-custom-commands} has two separate spots for setting | |
6008 | options. You can add options that should be valid for just a single | |
6009 | command in the set, and options that should be valid for all commands in | |
6010 | the set. The former are just added to the command entry, the latter | |
6011 | must come after the list of command entries. Going back to the block | |
6012 | agenda example (@pxref{Block agenda}), let's change the sorting strategy | |
6013 | for the @kbd{C-c a h} commands to @code{priority-down}, but let's sort | |
6014 | the 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 | ||
6033 | As you see, the values and parenthesis setting is a little complex. | |
6034 | When in doubt, use the customize interface to set this variable - it | |
6035 | fully supports its structure. Just one caveat: When setting options in | |
6036 | this interface, the @emph{values} are just lisp expressions. So if the | |
6037 | value is a string, you need to add the double quotes around the value | |
6038 | yourself. | |
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 | ||
6045 | If you are away from your computer, it can be very useful to have a | |
a7808fba | 6046 | printed version of some agenda views to carry around. Org mode can |
4009494e | 6047 | export custom agenda views as plain text, HTML@footnote{You need to |
28a16a1b CD |
6048 | install Hrvoje Niksic' @file{htmlize.el}.} postscript, and iCalendar |
6049 | files. 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 | |
6056 | Write the agenda view to a file. Depending on the extension of the | |
6057 | selected file name, the view will be exported as HTML (extension | |
28a16a1b CD |
6058 | @file{.html} or @file{.htm}), Postscript (extension @file{.ps}), |
6059 | iCalendar (extension @file{.ics}), or plain text (any other extension). | |
6060 | Use the variable @code{org-agenda-exporter-settings} to | |
6061 | set options for @file{ps-print} and for @file{htmlize} to be used during | |
6062 | export, 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 | ||
6072 | If you need to export certain agenda views frequently, you can associate | |
6073 | any custom agenda command with a list of output file names | |
6074 | @footnote{If you want to store standard views like the weekly agenda | |
6075 | or the global TODO list as well, you need to define custom commands for | |
28a16a1b | 6076 | them in order to be able to specify file names.}. Here is an example |
4009494e GM |
6077 | that first does define custom commands for the agenda and the global |
6078 | todo list, together with a number of files to which to export them. | |
28a16a1b | 6079 | Then we define two block agenda commands and specify file names for them |
4009494e GM |
6080 | as well. File names can be relative to the current working directory, |
6081 | or 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 | ||
6103 | The 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 |
6105 | the 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 |
6107 | postscript output. If the extension is @file{.ics}, iCalendar export is |
6108 | run export over all files that were used to construct the agenda, and | |
6109 | limit the export to entries listed in the agenda now. Any other | |
6110 | extension produces a plain ASCII file. | |
4009494e GM |
6111 | |
6112 | The export files are @emph{not} created when you use one of those | |
28a16a1b CD |
6113 | commands interactively because this might use too much overhead. |
6114 | Instead, there is a special command to produce @emph{all} specified | |
6115 | files in one step: | |
4009494e GM |
6116 | |
6117 | @table @kbd | |
6118 | @kindex C-c a e | |
6119 | @item C-c a e | |
28a16a1b | 6120 | Export all agenda views that have export file names associated with |
4009494e GM |
6121 | them. |
6122 | @end table | |
6123 | ||
6124 | You can use the options section of the custom agenda commands to also | |
6125 | set 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 | |
6139 | This command sets two options for the postscript exporter, to make it | |
6140 | print in two columns in landscape format - the resulting page can be cut | |
6141 | in two and then used in a paper agenda. The remaining settings modify | |
6142 | the agenda prefix to omit category and scheduling information, and | |
6143 | instead include a checkbox to check off items. We also remove the tags | |
6144 | to make the lines compact, and we don't want to use colors for the | |
6145 | black-and-white printer. Settings specified in | |
6146 | @code{org-agenda-exporter-settings} will also apply, but the settings | |
6147 | in @code{org-agenda-custom-commands} take precedence. | |
6148 | ||
6149 | @noindent | |
6150 | From the command line you may also use | |
6151 | @example | |
6152 | emacs -f org-batch-store-agenda-views -kill | |
6153 | @end example | |
6154 | @noindent | |
6155 | or, if you need to modify some parameters | |
6156 | @example | |
6157 | emacs -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 | |
6165 | which will create the agenda views restricted to the file | |
6166 | @file{~/org/project.org}, without diary entries and with 30 days | |
28a16a1b | 6167 | extent. |
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 | 6174 | Org provides commands to access agenda information for the command |
4009494e GM |
6175 | line in emacs batch mode. This extracted information can be sent |
6176 | directly to a printer, or it can be read by a program that does further | |
6177 | processing 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 | |
6179 | ASCII text to STDOUT. The command takes a single string as parameter. | |
6180 | If the string has length 1, it is used as a key to one of the commands | |
6181 | you have configured in @code{org-agenda-custom-commands}, basically any | |
6182 | key you can use after @kbd{C-c a}. For example, to directly print the | |
6183 | current TODO list, you could use | |
6184 | ||
6185 | @example | |
6186 | emacs -batch -l ~/.emacs -eval '(org-batch-agenda "t")' | lpr | |
6187 | @end example | |
6188 | ||
6189 | If the parameter is a string with 2 or more characters, it is used as a | |
6190 | tags/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 | 6195 | emacs -batch -l ~/.emacs \ |
4009494e GM |
6196 | -eval '(org-batch-agenda "+shop-NewYork")' | lpr |
6197 | @end example | |
6198 | ||
6199 | @noindent | |
6200 | You may also modify parameters on the fly like this: | |
6201 | ||
6202 | @example | |
6203 | emacs -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 | |
6212 | which will produce a 30 day agenda, fully restricted to the Org file | |
6213 | @file{~/org/projects.org}, not even including the diary. | |
6214 | ||
6215 | If you want to process the agenda data in more sophisticated ways, you | |
6216 | can use the command @code{org-batch-agenda-csv} to get a comma-separated | |
6217 | list of values for each agenda item. Each line in the output will | |
6218 | contain a number of fields separated by commas. The fields in a line | |
6219 | are: | |
6220 | ||
6221 | @example | |
6222 | category @r{The category of the item} | |
6223 | head @r{The headline, without TODO kwd, TAGS and PRIORITY} | |
6224 | type @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 | 6235 | todo @r{The TODO keyword, if any} |
4009494e GM |
6236 | tags @r{All tags including inherited ones, separated by colons} |
6237 | date @r{The relevant date, like 2007-2-14} | |
6238 | time @r{The time, like 15:00-16:50} | |
6239 | extra @r{String with extra planning info} | |
6240 | priority-l @r{The priority letter if any was given} | |
6241 | priority-n @r{The computed numerical priority} | |
6242 | @end example | |
6243 | ||
6244 | @noindent | |
6245 | Time and date will only be given if a timestamp (or deadline/scheduled) | |
6246 | lead to the selection of the item. | |
6247 | ||
6248 | A CSV list like this is very easy to use in a post processing script. | |
6249 | For example, here is a Perl program that gets the TODO list from | |
a7808fba | 6250 | Emacs/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 | |
6263 | foreach $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 | ||
6280 | Column view (@pxref{Column view}) is normally used to view and edit | |
6281 | properties embedded in the hierarchical structure of an Org file. It can be | |
6282 | quite useful to use column view also from the agenda, where entries are | |
6283 | collected by certain criteria. | |
6284 | ||
6285 | @table @kbd | |
6286 | @kindex C-c C-x C-c | |
6287 | @item C-c C-x C-c | |
6288 | Turn on column view in the agenda. | |
6289 | @end table | |
6290 | ||
6291 | To understand how to use this properly, it is important to realize that the | |
6292 | entries in the agenda are no longer in their proper outline environment. | |
6293 | This causes the following issues: | |
6294 | ||
6295 | @enumerate | |
6296 | @item | |
6297 | Org needs to make a decision which @code{COLUMNS} format to use. Since the | |
6298 | entries in the agenda are collected from different files, and different files | |
6299 | may have different @code{COLUMNS} formats, this is a non-trivial problem. | |
6300 | Org first checks if the variable @code{org-overriding-columns-format} is | |
6301 | currently set, and if yes takes the format from there. Otherwise it takes | |
6302 | the format associated with the first item in the agenda, or, if that item | |
6303 | does not have a specific format (defined in a property, or in it's file), it | |
6304 | uses @code{org-columns-default-format}. | |
6305 | @item | |
6306 | If any of the columns has a summary type defined (@pxref{Column attributes}), | |
6307 | turning on column view in the agenda will visit all relevant agenda files and | |
6308 | make sure that the computations of this property are up to date. This is | |
6309 | also true for the special @code{CLOCKSUM} property. Org will then sum the | |
6310 | values displayed in the agenda. In the daily/weekly agenda, the sums will | |
6311 | cover a single day, in all other views they cover the entire block. It is | |
6312 | vital to realize that the agenda may show the same entry @emph{twice} (for | |
6313 | example as scheduled and as a deadline), and it may show two entries from the | |
6314 | same hierarchy (for example a @emph{parent} and it's @emph{child}). In these | |
6315 | cases, the summation in the agenda will lead to incorrect results because | |
6316 | some values will count double. | |
6317 | @item | |
6318 | When the column view in the agenda shows the @code{CLOCKSUM}, that is always | |
6319 | the entire clocked time for this item. So even in the daily/weekly agenda, | |
6320 | the clocksum listed in column view may originate from times outside the | |
6321 | current view. This has the advantage that you can compare these values with | |
6322 | a column listing the planned total effort for a task - one of the major | |
6323 | applications for column view in the agenda. If you want information about | |
6324 | clocked time in the displayed period use clock table mode (press @kbd{R} in | |
6325 | the 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 | ||
6334 | Plain ASCII is normally sufficient for almost all note taking. One | |
a7808fba CD |
6335 | exception, however, are scientific notes which need to be able to contain |
6336 | mathematical symbols and the occasional formula. La@TeX{}@footnote{La@TeX{} | |
6337 | is a macro system based on Donald E. Knuth's @TeX{} system. Many of the | |
6338 | features described here as ``La@TeX{}'' are really from @TeX{}, but for | |
6339 | simplicity I am blurring this distinction.} is widely used to typeset | |
6340 | scientific documents. Org mode supports embedding La@TeX{} code into its | |
6341 | files, because many academics are used to reading La@TeX{} source code, and | |
6342 | because it can be readily processed into images for HTML production. | |
4009494e GM |
6343 | |
6344 | It is not necessary to mark La@TeX{} macros and code in any special way. | |
a7808fba | 6345 | If you observe a few conventions, Org mode knows how to find it and what |
4009494e GM |
6346 | to 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 | ||
6361 | You can use La@TeX{} macros to insert special symbols like @samp{\alpha} | |
6362 | to indicate the Greek letter, or @samp{\to} to indicate an arrow. | |
6363 | Completion for these macros is available, just type @samp{\} and maybe a | |
6364 | few letters, and press @kbd{M-@key{TAB}} to see possible completions. | |
a7808fba | 6365 | Unlike La@TeX{} code, Org mode allows these macros to be present |
4009494e GM |
6366 | without surrounding math delimiters, for example: |
6367 | ||
6368 | @example | |
6369 | Angles are written as Greek letters \alpha, \beta and \gamma. | |
6370 | @end example | |
6371 | ||
6372 | During HTML export (@pxref{HTML export}), these symbols are translated | |
6373 | into the proper syntax for HTML, for the above examples this is | |
6374 | @samp{α} and @samp{→}, 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 | ||
6381 | Just like in La@TeX{}, @samp{^} and @samp{_} are used to indicate super- | |
6382 | and subscripts. Again, these can be used without embedding them in | |
6383 | math-mode delimiters. To increase the readability of ASCII text, it is | |
6384 | not necessary (but OK) to surround multi-character sub- and superscripts | |
6385 | with curly braces. For example | |
6386 | ||
6387 | @example | |
6388 | The mass if the sun is M_sun = 1.989 x 10^30 kg. The radius of | |
6389 | the sun is R_@{sun@} = 6.96 x 10^8 m. | |
6390 | @end example | |
6391 | ||
6392 | To avoid interpretation as raised or lowered text, you can quote | |
6393 | @samp{^} and @samp{_} with a backslash: @samp{\_} and @samp{\^}. | |
6394 | ||
6395 | During HTML export (@pxref{HTML export}), subscript and superscripts | |
6396 | are 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 | ||
6402 | With symbols, sub- and superscripts, HTML is pretty much at its end when | |
6403 | it comes to representing mathematical formulas@footnote{Yes, there is | |
6404 | MathML, but that is not yet fully supported by many browsers, and there | |
6405 | is no decent converter for turning La@TeX{} or ASCII representations of | |
6406 | formulas into MathML. So for the time being, converting formulas into | |
6407 | images seems the way to go.}. More complex expressions need a dedicated | |
a7808fba | 6408 | formula processor. To this end, Org mode can contain arbitrary La@TeX{} |
4009494e GM |
6409 | fragments. It provides commands to preview the typeset result of these |
6410 | fragments, and upon export to HTML, all fragments will be converted to | |
6411 | images and inlined into the HTML document@footnote{The La@TeX{} export | |
6412 | will not use images for displaying La@TeX{} fragments but include these | |
6413 | fragments directly into the La@TeX{} code.}. For this to work you | |
6414 | need to be on a system with a working La@TeX{} installation. You also | |
6415 | need the @file{dvipng} program, available at | |
6416 | @url{http://sourceforge.net/projects/dvipng/}. The La@TeX{} header that | |
6417 | will be used when processing a fragment can be configured with the | |
6418 | variable @code{org-format-latex-header}. | |
6419 | ||
6420 | La@TeX{} fragments don't need any special marking at all. The following | |
6421 | snippets will be identified as La@TeX{} source code: | |
6422 | @itemize @bullet | |
6423 | @item | |
6424 | Environments of any kind. The only requirement is that the | |
6425 | @code{\begin} statement appears on a new line, preceded by only | |
6426 | whitespace. | |
6427 | @item | |
6428 | Text within the usual La@TeX{} math delimiters. To avoid conflicts with | |
6429 | currency specifications, single @samp{$} characters are only recognized | |
6430 | as math delimiters if the enclosed text contains at most two line breaks, | |
6431 | is directly attached to the @samp{$} characters with no whitespace in | |
6432 | between, and if the closing @samp{$} is followed by whitespace or | |
6433 | punctuation. For the other delimiters, there is no such restriction, so | |
6434 | when in doubt, use @samp{\(...\)} as inline math delimiters. | |
6435 | @end itemize | |
6436 | ||
6437 | @noindent For example: | |
6438 | ||
6439 | @example | |
6440 | \begin@{equation@} % arbitrary environments, | |
6441 | x=\sqrt@{b@} % even tables, figures | |
6442 | \end@{equation@} % etc | |
6443 | ||
6444 | If $a^2=b$ and \( b=2 \), then the solution must be | |
6445 | either $$ a=+\sqrt@{2@} $$ or \[ a=-\sqrt@{2@} \]. | |
6446 | @end example | |
6447 | ||
6448 | @noindent | |
6449 | If you need any of the delimiter ASCII sequences for other purposes, you | |
6450 | can configure the option @code{org-format-latex-options} to deselect the | |
6451 | ones 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 | ||
6457 | La@TeX{} fragments can be processed to produce a preview images of the | |
6458 | typeset expressions: | |
6459 | ||
6460 | @table @kbd | |
6461 | @kindex C-c C-x C-l | |
6462 | @item C-c C-x C-l | |
6463 | Produce a preview image of the La@TeX{} fragment at point and overlay it | |
6464 | over the source code. If there is no fragment at point, process all | |
6465 | fragments in the current entry (between two headlines). When called | |
6466 | with a prefix argument, process the entire subtree. When called with | |
6467 | two prefix arguments, or when the cursor is before the first headline, | |
6468 | process the entire buffer. | |
6469 | @kindex C-c C-c | |
6470 | @item C-c C-c | |
6471 | Remove the overlay preview images. | |
6472 | @end table | |
6473 | ||
6474 | During HTML export (@pxref{HTML export}), all La@TeX{} fragments are | |
6475 | converted into images and inlined into the document if the following | |
6476 | setting 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 | 6486 | CDLaTeX mode is a minor mode that is normally used in combination with a |
4009494e | 6487 | major La@TeX{} mode like AUCTeX in order to speed-up insertion of |
a7808fba CD |
6488 | environments and math templates. Inside Org mode, you can make use of |
6489 | some 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 |
6491 | AUCTeX) from @url{http://www.astro.uva.nl/~dominik/Tools/cdlatex}. | |
a7808fba CD |
6492 | Don't use CDLaTeX mode itself under Org mode, but use the light |
6493 | version @code{org-cdlatex-mode} that comes as part of Org mode. Turn it | |
4009494e | 6494 | on for the current buffer with @code{M-x org-cdlatex-mode}, or for all |
a7808fba | 6495 | Org files with |
4009494e GM |
6496 | |
6497 | @lisp | |
6498 | (add-hook 'org-mode-hook 'turn-on-org-cdlatex) | |
6499 | @end lisp | |
6500 | ||
6501 | When this mode is enabled, the following features are present (for more | |
a7808fba | 6502 | details see the documentation of CDLaTeX mode): |
4009494e GM |
6503 | @itemize @bullet |
6504 | @kindex C-c @{ | |
6505 | @item | |
6506 | Environment templates can be inserted with @kbd{C-c @{}. | |
6507 | @item | |
6508 | @kindex @key{TAB} | |
6509 | The @key{TAB} key will do template expansion if the cursor is inside a | |
a7808fba | 6510 | La@TeX{} fragment@footnote{Org mode has a method to test if the cursor is |
4009494e GM |
6511 | inside such a fragment, see the documentation of the function |
6512 | @code{org-inside-LaTeX-fragment-p}.}. For example, @key{TAB} will | |
6513 | expand @code{fr} to @code{\frac@{@}@{@}} and position the cursor | |
6514 | correctly inside the first brace. Another @key{TAB} will get you into | |
6515 | the second brace. Even outside fragments, @key{TAB} will expand | |
6516 | environment abbreviations at the beginning of a line. For example, if | |
6517 | you write @samp{equ} at the beginning of a line and press @key{TAB}, | |
6518 | this abbreviation will be expanded to an @code{equation} environment. | |
6519 | To get a list of all abbreviations, type @kbd{M-x cdlatex-command-help}. | |
6520 | @item | |
6521 | @kindex _ | |
6522 | @kindex ^ | |
6523 | Pressing @kbd{_} and @kbd{^} inside a La@TeX{} fragment will insert these | |
6524 | characters together with a pair of braces. If you use @key{TAB} to move | |
6525 | out of the braces, and if the braces surround only a single character or | |
6526 | macro, they are removed again (depending on the variable | |
6527 | @code{cdlatex-simplify-sub-super-scripts}). | |
6528 | @item | |
6529 | @kindex ` | |
6530 | Pressing the backquote @kbd{`} followed by a character inserts math | |
6531 | macros, also outside La@TeX{} fragments. If you wait more than 1.5 seconds | |
6532 | after the backquote, a help window will pop up. | |
6533 | @item | |
6534 | @kindex ' | |
6535 | Pressing the normal quote @kbd{'} followed by another character modifies | |
6536 | the symbol before point with an accent or a font. If you wait more than | |
6537 | 1.5 seconds after the backquote, a help window will pop up. Character | |
6538 | modification will work only inside La@TeX{} fragments, outside the quote | |
6539 | is normal. | |
6540 | @end itemize | |
6541 | ||
6542 | @node Exporting, Publishing, Embedded LaTeX, Top | |
6543 | @chapter Exporting | |
6544 | @cindex exporting | |
6545 | ||
a7808fba | 6546 | Org mode documents can be exported into a variety of other formats. For |
4009494e | 6547 | printing and sharing of notes, ASCII export produces a readable and |
a7808fba | 6548 | simple version of an Org file. HTML export allows you to publish a |
4009494e GM |
6549 | notes file on the web, while the XOXO format provides a solid base for |
6550 | exchange with a broad range of other applications. La@TeX{} export lets | |
a7808fba | 6551 | you use Org mode and its structured editing functions to easily create |
4009494e GM |
6552 | La@TeX{} files. To incorporate entries with associated times like |
6553 | deadlines or appointments into a desktop calendar program like iCal, | |
a7808fba CD |
6554 | Org mode can also produce extracts in the iCalendar format. Currently |
6555 | Org mode only supports export, not import of these different formats. | |
4009494e | 6556 | |
a7808fba | 6557 | When exporting, Org mode uses special conventions to enrich the output |
4009494e GM |
6558 | produced. @xref{Text interpretation}, for more details. |
6559 | ||
6560 | @table @kbd | |
6561 | @kindex C-c C-e | |
6562 | @item C-c C-e | |
6563 | Dispatcher for export and publishing commands. Displays a help-window | |
6564 | listing the additional key(s) needed to launch an export or publishing | |
a7808fba CD |
6565 | command. 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 | |
6567 | background if that seems useful for the specific command (i.e. commands that | |
6568 | write to a file). | |
6569 | @kindex C-u C-u C-c C-e | |
6570 | @item C-u C-u C-c C-e | |
6571 | Call an the exporter, but reverse the setting of | |
6572 | @code{org-export-run-in-background}, i.e. request background processing if | |
6573 | not 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 | 6589 | ASCII export produces a simple and very readable version of an Org mode |
4009494e GM |
6590 | file. |
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 | |
6598 | Export as ASCII file. For an org file @file{myfile.org}, the ASCII file | |
6599 | will be @file{myfile.txt}. The file will be overwritten without | |
6600 | warning. If there is an active region, only the region will be | |
6601 | exported. If the selected region is a single tree, the tree head will | |
6602 | become 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 | 6604 | export. |
4009494e GM |
6605 | @kindex C-c C-e v a |
6606 | @item C-c C-e v a | |
6607 | Export only the visible part of the document. | |
6608 | @end table | |
6609 | ||
6610 | @cindex headline levels, for exporting | |
6611 | In the exported version, the first 3 outline levels will become | |
6612 | headlines, defining a general document structure. Additional levels | |
6613 | will be exported as itemized lists. If you want that transition to occur | |
6614 | at 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 | |
6621 | creates only top level headlines and does the rest as items. When | |
6622 | headlines are converted to items, the indentation of the text following | |
6623 | the headline is changed to fit nicely under the item. This is done with | |
a7808fba | 6624 | the assumption that the first body line indicates the base indentation of |
4009494e GM |
6625 | the body text. Any indentation larger than this is adjusted to preserve |
6626 | the layout relative to the first line. Should there be lines with less | |
6627 | indentation 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 | 6633 | Org mode contains an HTML (XHTML 1.0 strict) exporter with extensive |
4009494e GM |
6634 | HTML formatting, in ways similar to John Grubers @emph{markdown} |
6635 | language, 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 | |
6655 | Export as HTML file @file{myfile.html}. For an org file | |
6656 | @file{myfile.org}, the ASCII file will be @file{myfile.html}. The file | |
6657 | will be overwritten without warning. If there is an active region, only | |
6658 | the region will be exported. If the selected region is a single tree, | |
6659 | the tree head will become the document title. If the tree head entry | |
dbc28aaa CD |
6660 | has or inherits an @code{:EXPORT_FILE_NAME:} property, that name will be |
6661 | used for the export. | |
4009494e GM |
6662 | @kindex C-c C-e b |
6663 | @item C-c C-e b | |
6664 | Export as HTML file and immediately open it with a browser. | |
6665 | @kindex C-c C-e H | |
6666 | @item C-c C-e H | |
6667 | Export 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 |
6670 | Export the active region to a temporary buffer. With a prefix argument, do |
6671 | not produce the file header and footer, but just the plain HTML section for | |
6672 | the 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 | |
6681 | Export only the visible part of the document. | |
6682 | @item M-x org-export-region-as-html | |
a7808fba | 6683 | Convert the region to HTML under the assumption that it was Org mode |
4009494e GM |
6684 | syntax before. This is a global command that can be invoked in any |
6685 | buffer. | |
6686 | @item M-x org-replace-region-by-HTML | |
a7808fba | 6687 | Replace the active region (assumed to be in Org mode syntax) by HTML |
4009494e GM |
6688 | code. |
6689 | @end table | |
6690 | ||
6691 | @cindex headline levels, for exporting | |
a7808fba CD |
6692 | In the exported version, the first 3 outline levels will become headlines, |
6693 | defining a general document structure. Additional levels will be exported as | |
6694 | itemized lists. If you want that transition to occur at a different level, | |
6695 | specify 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 | |
6702 | creates 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 | ||
6707 | Plain @samp{<} and @samp{>} are always transformed to @samp{<} and | |
6708 | @samp{>} in HTML export. If you want to include simple HTML tags | |
6709 | which should be interpreted as such, mark them with @samp{@@} as in | |
6710 | @samp{@@<b>bold text@@</b>}. Note that this really works only for | |
6711 | simple tags. For more extensive HTML that should be copied verbatim to | |
6712 | the 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 | |
6722 | All 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 | |
6733 | Internal links (@pxref{Internal links}) will continue to work in HTML | |
6734 | files only if they match a dedicated @samp{<<target>>}. Automatic links | |
6735 | created by radio targets (@pxref{Radio targets}) will also work in the | |
6736 | HTML file. Links to external files will still work if the HTML file is | |
a7808fba | 6737 | in the same directory as the Org file. Links to other @file{.org} |
4009494e GM |
6738 | files will be translated into HTML links under the assumption that an |
6739 | HTML version also exists of the linked file. For information related to | |
6740 | linking 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 | 6748 | HTML export can inline images given as links in the Org file, and |
4009494e GM |
6749 | it can make an image the clickable part of a link. By |
6750 | default@footnote{but see the variable | |
6751 | @code{org-export-html-inline-images}}, images are inlined if a link does | |
6752 | not have a description. So @samp{[[file:myimg.jpg]]} will be inlined, | |
6753 | while @samp{[[file:myimg.jpg][the image]]} will just produce a link | |
6754 | @samp{the image} that points to the image. If the description part | |
6755 | itself is a @code{file:} link or a @code{http:} URL pointing to an | |
6756 | image, this image will be inlined and activated so that clicking on the | |
6757 | image will activate the link. For example, to include a thumbnail that | |
6758 | will 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 | |
6765 | and 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 | |
6772 | You can also give style information for the exported file. The HTML | |
6773 | exporter assigns the following CSS classes to appropriate parts of the | |
6774 | document - 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 | ||
6784 | The default style specification can be configured through the option | |
6785 | @code{org-export-html-style}. If you want to use a file-local style, | |
6786 | you may use file variables, best wrapped into a COMMENT section at the | |
6787 | end of the outline tree. For example@footnote{Under Emacs 21, the | |
6788 | continuation lines for a variable value should have no @samp{#} at the | |
6789 | start 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 | ||
6802 | Remember to execute @kbd{M-x normal-mode} after changing this to make | |
a7808fba | 6803 | the new style visible to Emacs. This command restarts Org mode for the |
4009494e GM |
6804 | current buffer and forces Emacs to re-evaluate the local variables |
6805 | section 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 | |
6814 | enhance the web viewing experience of HTML files created with Org. This | |
6815 | program allows to view large files in two different ways. The first one is | |
6816 | an @emph{Info}-like mode where each section is displayed separately and | |
6817 | navigation can be done with the @kbd{n} and @kbd{p} keys (and some other keys | |
6818 | as well, press @kbd{?} for an overview of the available keys). The second | |
6819 | view type is a @emph{folding} view much like Org provides it inside Emacs. | |
6820 | The script is available at @url{http://orgmode.org/org-info.js} and you can | |
6821 | find the documentation for it at @url{http://orgmode.org/org-infojs.html}. | |
6822 | We are serving the script from our site, but if you use it a lot, you might | |
6823 | not want to be dependent on @url{orgmode.org} and prefer to install a local | |
6824 | copy on your own web server. | |
6825 | ||
6826 | To use the script, you need to make sure that the @file{org-infojs.el} module | |
6827 | gets 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 | |
6829 | case. All it then takes to make use of the program is adding a single line | |
6830 | to the Org file: | |
6831 | ||
6832 | @example | |
6833 | #+INFOSJ_OPT: view:info toc:nil | |
6834 | @end example | |
6835 | ||
6836 | @noindent | |
6837 | If this line is found, the HTML header will automatically contain the code | |
6838 | needed to invoke the script. Using the line above, you can set the following | |
6839 | viewing options: | |
6840 | ||
6841 | @example | |
6842 | path: @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}.} | |
6845 | view: @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.} | |
6850 | sdepth: @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.} | |
6855 | toc: @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}.} | |
6857 | tdepth: @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}.} | |
6859 | ltoc: @r{Should there be short contents (children) in each section?} | |
6860 | mouse: @r{Headings are highlighted when the mouse is over them. Should be} | |
6861 | @r{@samp{underline} (default) or a background color like @samp{#cccccc}.} | |
6862 | buttons: @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 | ||
6866 | You 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 | |
6868 | pages, 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 | 6874 | Org 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 | |
6888 | Export as La@TeX{} file @file{myfile.tex}. | |
6889 | @kindex C-c C-e L | |
6890 | @item C-c C-e L | |
6891 | Export 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 | |
6896 | Export only the visible part of the document. | |
6897 | @item M-x org-export-region-as-latex | |
a7808fba | 6898 | Convert the region to La@TeX{} under the assumption that it was Org mode |
4009494e GM |
6899 | syntax before. This is a global command that can be invoked in any |
6900 | buffer. | |
6901 | @item M-x org-replace-region-by-latex | |
a7808fba | 6902 | Replace the active region (assumed to be in Org mode syntax) by La@TeX{} |
4009494e GM |
6903 | code. |
6904 | @end table | |
6905 | ||
6906 | @cindex headline levels, for exporting | |
6907 | In the exported version, the first 3 outline levels will become | |
6908 | headlines, defining a general document structure. Additional levels | |
6909 | will be exported as description lists. The exporter can ignore them or | |
6910 | convert them to a custom string depending on | |
6911 | @code{org-latex-low-levels}. | |
6912 | ||
6913 | If you want that transition to occur at a different level, specify it | |
a7808fba | 6914 | with 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 | |
6921 | creates 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 | ||
6926 | Embedded La@TeX{} as described in @ref{Embedded LaTeX} will be correctly | |
a7808fba | 6927 | inserted into the La@TeX{} file. Furthermore, you can add special code |
4009494e GM |
6928 | that should only be present in La@TeX{} export with the following |
6929 | constructs: | |
6930 | ||
6931 | @example | |
6932 | #+LaTeX: Literal LaTeX code for export | |
6933 | @end example | |
6934 | ||
6935 | @noindent or | |
6936 | ||
6937 | @example | |
6938 | #+BEGIN_LaTeX | |
6939 | All 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 | ||
6950 | By default, the La@TeX{} output uses the class @code{article}. | |
6951 | ||
6952 | You can change this globally by setting a different value for | |
6953 | @code{org-export-latex-default-class} or locally by adding an option | |
6954 | like @code{#+LaTeX_CLASS: myclass} in your file. The class should be | |
6955 | listed in @code{org-export-latex-classes}, where you can also define the | |
6956 | sectioning 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 | 6963 | Org mode contains an exporter that produces XOXO-style output. |
4009494e | 6964 | Currently, this exporter only handles the general outline structure and |
a7808fba | 6965 | does 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 | |
6970 | Export as XOXO file @file{myfile.html}. | |
6971 | @kindex C-c C-e v | |
6972 | @item C-c C-e v x | |
6973 | Export 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 | 6980 | Some people like to use Org mode for keeping track of projects, but |
4009494e GM |
6981 | still prefer a standard calendar application for anniversaries and |
6982 | appointments. In this case it can be useful to have deadlines and | |
a7808fba CD |
6983 | other time-stamped items in Org files show up in the calendar |
6984 | application. Org mode can export calendar information in the standard | |
4009494e GM |
6985 | iCalendar format. If you also want to have TODO entries included in the |
6986 | export, 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 | |
6991 | Create iCalendar entries for the current file and store them in the same | |
6992 | directory, using a file extension @file{.ics}. | |
6993 | @kindex C-c C-e I | |
6994 | @item C-c C-e I | |
6995 | Like @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 | |
6997 | file will be written. | |
6998 | @kindex C-c C-e c | |
6999 | @item C-c C-e c | |
7000 | Create 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 |
7005 | The export will honor SUMMARY, DESCRIPTION and LOCATION properties if |
7006 | the selected entries have them. If not, the summary will be derived | |
7007 | from the headline, and the description from the body (limited to | |
28a16a1b | 7008 | @code{org-icalendar-include-body} characters). |
dbc28aaa | 7009 | |
4009494e GM |
7010 | How this calendar is best read and updated, depends on the application |
7011 | you 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 | 7017 | The exporter backends interpret additional structure in the Org file |
4009494e GM |
7018 | in 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 | ||
7034 | Lines starting with @samp{#} in column zero are treated as comments | |
7035 | and will never be exported. Also entire subtrees starting with the | |
7036 | word @samp{COMMENT} will never be exported. | |
7037 | ||
7038 | @table @kbd | |
7039 | @kindex C-c ; | |
7040 | @item C-c ; | |
7041 | Toggle 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 | 7047 | Org mode normally ignores any text before the first headline when |
4009494e GM |
7048 | exporting, leaving this region for internal links to speed up navigation |
7049 | etc. However, in publishing-oriented files, you might want to have some | |
7050 | text before the first headline, like a small introduction, special HTML | |
7051 | code with a navigation bar, etc. You can ask to have this part of the | |
7052 | file exported as well by setting the variable | |
7053 | @code{org-export-skip-text-before-1st-heading} to @code{nil}. On a | |
7054 | per-file basis, you can get the same effect with | |
7055 | ||
7056 | @example | |
7057 | #+OPTIONS: skip:nil | |
7058 | @end example | |
7059 | ||
7060 | The text before the first headline will be fully processed | |
7061 | (@pxref{Enhancing text}), and the first non-comment line becomes the | |
7062 | title of the exported document. If you need to include literal HTML, | |
7063 | use the special constructs described in @ref{Quoting HTML tags}. The | |
7064 | table of contents is normally inserted directly before the first | |
7065 | headline of the file. If you would like to get it to a different | |
7066 | location, insert the string @code{[TABLE-OF-CONTENTS]} on a line by | |
7067 | itself at the desired location. | |
7068 | ||
7069 | Finally, if you want to use the space before the first headline for | |
7070 | internal purposes, but @emph{still} want to place something before the | |
7071 | first headline when exporting the file, you can use the @code{#+TEXT} | |
7072 | construct: | |
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 | ||
7087 | Numbers in square brackets are treated as footnotes, so that you can use | |
7088 | the Emacs package @file{footnote.el} to create footnotes. For example: | |
7089 | ||
7090 | @example | |
a7808fba | 7091 | The Org homepage[1] clearly needs help from |
4009494e GM |
7092 | a 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 ! | |
7099 | Note that the @file{footnote} package uses @kbd{C-c !} to invoke its | |
a7808fba | 7100 | commands. This binding conflicts with the Org mode command for |
4009494e GM |
7101 | inserting inactive time stamps. You could use the variable |
7102 | @code{footnote-prefix} to switch footnotes commands to another key. Or, | |
7103 | if you are too used to this binding, you could use | |
7104 | @code{org-replace-disputed-keys} and @code{org-disputed-keys} to change | |
a7808fba | 7105 | the 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 | ||
7114 | When writing technical documents, you often need to insert examples that | |
a7808fba | 7115 | are not further interpreted by Org mode. For historical reasons, there |
dbc28aaa CD |
7116 | are several ways to do this: |
7117 | ||
7118 | @itemize @bullet | |
7119 | @item | |
7120 | If a headline starts with the word @samp{QUOTE}, the text below the | |
7121 | headline will be typeset as fixed-width, to allow quoting of computer | |
7122 | codes etc. | |
7123 | @item | |
28a16a1b | 7124 | Lines starting with @samp{:} are also typeset in fixed-width font. |
dbc28aaa CD |
7125 | @table @kbd |
7126 | @kindex C-c : | |
7127 | @item C-c : | |
7128 | Toggle fixed-width for entry (QUOTE) or region, see below. | |
7129 | @end table | |
7130 | @item | |
7131 | Finally, text between | |
7132 | @example | |
7133 | #+BEGIN_EXAMPLE | |
7134 | quoted text | |
7135 | #+END_EXAMPLE | |
7136 | @end example | |
7137 | will 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 | 7146 | Some of the export backends of Org mode allow for sophisticated text |
4009494e | 7147 | formatting, this is true in particular for the HTML and La@TeX{} |
a7808fba | 7148 | backends. Org mode has a number of typing conventions that allow to |
4009494e GM |
7149 | produce a richly formatted output. |
7150 | ||
7151 | @itemize @bullet | |
7152 | ||
7153 | @cindex hand-formatted lists | |
7154 | @cindex lists, hand-formatted | |
7155 | @item | |
7156 | Plain lists @samp{-}, @samp{*} or @samp{+} as bullet, or with @samp{1.} | |
7157 | or @samp{2)} as enumerator will be recognized and transformed if the | |
7158 | backend 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 |
7165 | You can make words @b{*bold*}, @i{/italic/}, _underlined_, @code{=code=} |
7166 | and @code{~verbatim~}, and, if you must, @samp{+strikethrough+}. Text | |
a7808fba | 7167 | in the code and verbatim string is not processed for Org mode specific |
dbc28aaa | 7168 | syntax, it is exported verbatim. |
4009494e GM |
7169 | |
7170 | @cindex horizontal rules, in exported files | |
7171 | @item | |
7172 | A line consisting of only dashes, and at least 5 of them, will be | |
7173 | exported as a horizontal line (@samp{<hr/>} in HTML). | |
7174 | ||
7175 | @cindex LaTeX fragments, export | |
7176 | @cindex TeX macros, export | |
7177 | @item | |
7178 | Many @TeX{} macros and entire La@TeX{} fragments are converted into HTML | |
7179 | entities or images (@pxref{Embedded LaTeX}). | |
7180 | ||
7181 | @cindex tables, export | |
7182 | @item | |
7183 | Tables are transformed into native tables under the exporter, if the | |
7184 | export backend supports this. Data fields before the first horizontal | |
7185 | separator line will be formatted as table header fields. | |
7186 | ||
7187 | @cindex fixed width | |
7188 | @item | |
7189 | If a headline starts with the word @samp{QUOTE}, the text below the | |
7190 | headline will be typeset as fixed-width, to allow quoting of computer | |
7191 | codes etc. Lines starting with @samp{:} are also typeset in fixed-width | |
28a16a1b | 7192 | font. |
4009494e GM |
7193 | @table @kbd |
7194 | @kindex C-c : | |
7195 | @item C-c : | |
7196 | Toggle fixed-width for entry (QUOTE) or region, see below. | |
7197 | @end table | |
dbc28aaa CD |
7198 | Finally, text between |
7199 | @example | |
7200 | #+BEGIN_EXAMPLE | |
7201 | quoted text | |
7202 | #+END_EXAMPLE | |
7203 | @end example | |
7204 | will also be exported in this way. | |
4009494e GM |
7205 | |
7206 | @cindex linebreak, forced | |
28a16a1b | 7207 | @item |
4009494e GM |
7208 | A double backslash @emph{at the end of a line} enforces a line break at |
7209 | this position. | |
dbc28aaa CD |
7210 | |
7211 | @cindex HTML entities, LaTeX entities | |
7212 | @item | |
7213 | Strings like @code{\alpha} will be exported as @code{α}, in the | |
7214 | HTML output. These strings are exported as @code{$\alpha$} in the | |
7215 | La@TeX{} output. Similarly, @code{\nbsp} will become @code{ } in | |
7216 | HTML and in La@TeX{}. This applies for a long list of entities, see | |
7217 | the variable @code{org-html-entities} for the complete list. | |
7218 | @c FIXME | |
4009494e GM |
7219 | @end itemize |
7220 | ||
7221 | If these conversions conflict with your habits of typing ASCII text, | |
7222 | they can all be turned off with corresponding variables. See the | |
7223 | customization group @code{org-export-general}, and the following section | |
7224 | which explains how to set export options with special lines in a | |
7225 | buffer. | |
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 | |
7233 | The exporter recognizes special lines in the buffer which provide | |
7234 | additional information. These lines may be put anywhere in the file. | |
7235 | The whole set of lines can be inserted into the buffer with @kbd{C-c | |
7236 | C-e t}. For individual lines, a good way to make sure the keyword is | |
7237 | correct 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 | |
7243 | Insert 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 | |
7258 | The OPTIONS line is a compact form to specify export settings. Here | |
7259 | you 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 | |
7276 | H: @r{set the number of headline levels for export} | |
7277 | num: @r{turn on/off section-numbers} | |
7278 | toc: @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 |
7287 | f: @r{turn on/off foototes like this[1].} |
7288 | *: @r{turn on/off emphasized text (bold, italic, underlined)} | |
7289 | TeX: @r{turn on/off simple @TeX{} macros in plain text} | |
7290 | LaTeX: @r{turn on/off La@TeX{} fragments} | |
7291 | skip: @r{turn on/off skipping the text before the first heading} | |
7292 | author: @r{turn on/off inclusion of author name/email into exported file} | |
7293 | timestamp: @r{turn on/off inclusion creation time into exported file} | |
dbc28aaa | 7294 | d: @r{turn on/off inclusion of drawers} |
4009494e GM |
7295 | @end example |
7296 | ||
7297 | These options take effect in both the HTML and La@TeX{} export, except | |
7298 | for @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 | 7305 | Org includes@footnote{@file{org-publish.el} is not distributed with |
4009494e GM |
7306 | Emacs 21, if you are still using Emacs 21, you need you need to download |
7307 | this file separately.} a publishing management system that allows you to | |
7308 | configure automatic HTML conversion of @emph{projects} composed of | |
7309 | interlinked org files. This system is called @emph{org-publish}. You can | |
7310 | also configure org-publish to automatically upload your exported HTML | |
7311 | pages and related attachments, such as images and source code files, to | |
a7808fba | 7312 | a web server. Org-publish turns Org into a web-site authoring tool. |
4009494e GM |
7313 | |
7314 | You can also use Org-publish to convert files into La@TeX{}, or even | |
7315 | combine HTML and La@TeX{} conversion so that files are available in both | |
7316 | formats on the server@footnote{Since La@TeX{} files on a server are not | |
7317 | that helpful, you surely want to perform further conversion on them -- | |
7318 | e.g. convert them to @code{PDF} format.}. | |
7319 | ||
a7808fba | 7320 | Org-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 | ||
7331 | Publishing needs significant configuration to specify files, destination | |
7332 | and 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 | ||
7349 | Org-publish is configured almost entirely through setting the value of | |
7350 | one variable, called @code{org-publish-project-alist}. | |
7351 | Each element of the list configures one project, and may be in one of | |
7352 | the 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 | ||
7363 | In both cases, projects are configured by specifying property values. | |
7364 | A project defines the set of files that will be published, as well as | |
7365 | the publishing configuration to use when publishing those files. When | |
7366 | a project takes the second form listed above, the individual members | |
7367 | of the ``components'' property are taken to be components of the | |
7368 | project, which group together files requiring different publishing | |
7369 | options. When you publish such a ``meta-project'' all the components | |
7370 | will 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 | ||
7376 | Most properties are optional, but some should always be set. In | |
7377 | particular, org-publish needs to know where to look for source files, | |
7378 | and 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 | |
7387 | run @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 | ||
7395 | By default, all files with extension @file{.org} in the base directory | |
7396 | are considered part of the project. This can be modified by setting the | |
28a16a1b | 7397 | properties |
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 | |
7401 | regular expression. | |
7402 | ||
28a16a1b | 7403 | @item @code{:exclude} |
4009494e GM |
7404 | @tab Regular expression to match file names that should not be |
7405 | published, even though they have been selected on the basis of their | |
7406 | extension. | |
7407 | ||
7408 | @item @code{:include} | |
7409 | @tab List of files to be included regardless of @code{:base-extension} | |
7410 | and @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 | ||
7417 | Publishing means that a file is copied to the destination directory and | |
7418 | possibly transformed in the process. The default transformation is to | |
a7808fba | 7419 | export 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 | |
7422 | using the function @code{org-publish-org-to-latex} instead. Other files | |
7423 | like images only need to be copied to the publishing destination. For | |
a7808fba | 7424 | non-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 | |
7430 | list of functions, which will all be called in turn. | |
7431 | @end multitable | |
7432 | ||
7433 | The function must accept two arguments: a property list containing at | |
7434 | least a @code{:publishing-directory} property, and the name of the file | |
7435 | to be published. It should take the specified file, make the necessary | |
7436 | transformation (if any) and place the result into the destination folder. | |
7437 | You can write your own publishing function, but @code{org-publish} | |
7438 | provides 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 | ||
7445 | The property list can be used to set many export options for the HTML | |
7446 | and La@TeX{} exporters. In most cases, these properties correspond to user | |
a7808fba | 7447 | variables in Org. The table below lists these properties along |
4009494e GM |
7448 | with the variable they belong to. See the documentation string for the |
7449 | respective 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 |
7481 | If you use several email addresses, separate them by a semi-column. |
7482 | ||
4009494e GM |
7483 | Most of the @code{org-export-with-*} variables have the same effect in |
7484 | both HTML and La@TeX{} exporters, except for @code{:TeX-macros} and | |
7485 | @code{:LaTeX-fragments}, respectively @code{nil} and @code{t} in the | |
7486 | La@TeX{} export. | |
7487 | ||
dbc28aaa CD |
7488 | When a property is given a value in @code{org-publish-project-alist}, |
7489 | its setting overrides the value of the corresponding user variable (if | |
7490 | any) during publishing. Options set within a file (@pxref{Export | |
4009494e GM |
7491 | options}), 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 | 7497 | To create a link from one Org file to another, you would use |
4009494e GM |
7498 | something like @samp{[[file:foo.org][The foo]]} or simply |
7499 | @samp{file:foo.org.} (@pxref{Hyperlinks}). Upon publishing this link | |
7500 | becomes a link to @file{foo.html}. In this way, you can interlink the | |
7501 | pages of your "org web" project and the links will work as expected when | |
7502 | you publish them to HTML. | |
7503 | ||
7504 | You may also link to related files, such as images. Provided you are | |
7505 | careful 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 |
7507 | too. @ref{Complex example} for an example of this usage. |
7508 | ||
a7808fba | 7509 | Sometime an Org file to be published may contain links that are |
4009494e | 7510 | only valid in your production environment, but not in the publishing |
28a16a1b | 7511 | location. 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 | |
7519 | to define a function for checking link validity. This function must | |
7520 | accept two arguments, the file name and a directory relative to which | |
7521 | the file name is interpreted in the production environment. If this | |
7522 | function returns @code{nil}, then the HTML generator will only insert a | |
7523 | description into the HTML file, but no link. One option for this | |
7524 | function is @code{org-publish-validate-link} which checks if the given | |
7525 | file 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 | ||
7531 | The following properties may be used to control publishing of an | |
7532 | index 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 | |
7537 | org-publish-all. | |
7538 | ||
7539 | @item @code{:index-filename} | |
7540 | @tab Filename for output of index. Defaults to @file{index.org} (which | |
7541 | becomes @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 |
7548 | Defaults to @code{org-publish-org-index}, which generates a plain list |
7549 | of links to all files in the project. | |
7550 | @end multitable | |
7551 | ||
7552 | @node Sample configuration, Triggering publication, Configuration, Publishing | |
7553 | @section Sample configuration | |
7554 | ||
7555 | Below we provide two example configurations. The first one is a simple | |
a7808fba | 7556 | project publishing only a set of Org files. The second example is |
4009494e GM |
7557 | more 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 | 7567 | This example publishes a set of Org files to the @file{public_html} |
4009494e GM |
7568 | directory 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 | ||
7585 | This more complicated example publishes an entire website, including | |
7586 | org files converted to HTML, image files, emacs lisp source code, and | |
a7808fba | 7587 | style sheets. The publishing-directory is remote and private files are |
4009494e GM |
7588 | excluded. |
7589 | ||
7590 | To ensure that links are preserved, care should be taken to replicate | |
7591 | your directory structure on the web server, and to use relative file | |
7592 | paths. For example, if your org files are kept in @file{~/org} and your | |
7593 | publishable images in @file{~/images}, you'd link to an image with | |
7594 | @c | |
7595 | @example | |
7596 | file:../images/myimage.png | |
7597 | @end example | |
7598 | @c | |
7599 | On the web server, the relative path to the image should be the | |
7600 | same. You can accomplish this by setting up an "images" folder in the | |
a7808fba | 7601 | right 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 | ||
7636 | Once org-publish is properly configured, you can publish with the | |
28a16a1b | 7637 | following functions: |
4009494e GM |
7638 | |
7639 | @table @kbd | |
7640 | @item C-c C-e C | |
7641 | Prompt for a specific project and publish all files that belong to it. | |
7642 | @item C-c C-e P | |
7643 | Publish the project containing the current file. | |
7644 | @item C-c C-e F | |
7645 | Publish only the current file. | |
7646 | @item C-c C-e A | |
7647 | Publish all projects. | |
7648 | @end table | |
7649 | ||
7650 | Org uses timestamps to track when a file has changed. The above | |
7651 | functions normally only publish changed files. You can override this and | |
7652 | force 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 | 7684 | Org supports in-buffer completion. This type of completion does |
4009494e GM |
7685 | not make use of the minibuffer. You simply type a few letters into |
7686 | the buffer and use the key to complete text right there. | |
7687 | ||
7688 | @table @kbd | |
7689 | @kindex M-@key{TAB} | |
7690 | @item M-@key{TAB} | |
7691 | Complete word at point | |
7692 | @itemize @bullet | |
7693 | @item | |
7694 | At the beginning of a headline, complete TODO keywords. | |
7695 | @item | |
7696 | After @samp{\}, complete @TeX{} symbols supported by the exporter. | |
7697 | @item | |
7698 | After @samp{*}, complete headlines in the current buffer so that they | |
7699 | can be used in search links like @samp{[[*find this headline]]}. | |
7700 | @item | |
7701 | After @samp{:} in a headline, complete tags. The list of tags is taken | |
7702 | from the variable @code{org-tag-alist} (possibly set through the | |
7703 | @samp{#+TAGS} in-buffer option, @pxref{Setting tags}), or it is created | |
7704 | dynamically from all tags used in the current buffer. | |
7705 | @item | |
7706 | After @samp{:} and not in a headline, complete property keys. The list | |
7707 | of keys is constructed dynamically from all keys used in the current | |
7708 | buffer. | |
7709 | @item | |
7710 | After @samp{[}, complete link abbreviations (@pxref{Link abbreviations}). | |
7711 | @item | |
7712 | After @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 |
7714 | option keyword is already complete, pressing @kbd{M-@key{TAB}} again |
7715 | will insert example settings for this keyword. | |
7716 | @item | |
7717 | In the line after @samp{#+STARTUP: }, complete startup keywords, | |
7718 | i.e. valid keys for this line. | |
7719 | @item | |
a7808fba | 7720 | Elsewhere, 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 | ||
7730 | There are more than 180 variables that can be used to customize | |
a7808fba | 7731 | Org. For the sake of compactness of the manual, I am not |
4009494e GM |
7732 | describing the variables here. A structured overview of customization |
7733 | variables is available with @kbd{M-x org-customize}. Or select | |
7734 | @code{Browse Org Group} from the @code{Org->Customization} menu. Many | |
7735 | settings can also be activated on a per-file basis, by putting special | |
7736 | lines 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 | 7743 | Org mode uses special lines in the buffer to define settings on a |
4009494e GM |
7744 | per-file basis. These lines start with a @samp{#+} followed by a |
7745 | keyword, a colon, and then individual words defining a setting. Several | |
7746 | setting words can be in the same line, but you can also have multiple | |
7747 | lines for the keyword. While these settings are described throughout | |
7748 | the manual, here is a summary. After changing any of those lines in the | |
7749 | buffer, press @kbd{C-c C-c} with the cursor still in the line to | |
7750 | activate the changes immediately. Otherwise they become effective only | |
7751 | when the file is visited again in a new Emacs session. | |
7752 | ||
7753 | @table @kbd | |
7754 | @item #+ARCHIVE: %s_done:: | |
7755 | This line sets the archive location for the agenda file. It applies for | |
7756 | all subsequent lines until the next @samp{#+ARCHIVE} line, or the end | |
7757 | of the file. The first such line also applies to any entries before it. | |
7758 | The corresponding variable is @code{org-archive-location}. | |
7759 | @item #+CATEGORY: | |
7760 | This line sets the category for the agenda file. The category applies | |
7761 | for all subsequent lines until the next @samp{#+CATEGORY} line, or the | |
7762 | end of the file. The first such line also applies to any entries before it. | |
7763 | @item #+COLUMNS: %25ITEM ..... | |
7764 | Set the default format for columns view. This format applies when | |
dbc28aaa CD |
7765 | columns view is invoked in location where no @code{COLUMNS} property |
7766 | applies. | |
4009494e GM |
7767 | @item #+CONSTANTS: name1=value1 ... |
7768 | Set file-local values for constants to be used in table formulas. This | |
7769 | line set the local variable @code{org-table-formula-constants-local}. | |
dbc28aaa | 7770 | The global version of this variable is |
4009494e | 7771 | @code{org-table-formula-constants}. |
dbc28aaa CD |
7772 | @item #+DRAWERS: NAME1 ..... |
7773 | Set the file-local set of drawers. The corresponding global variable is | |
7774 | @code{org-drawers}. | |
4009494e GM |
7775 | @item #+LINK: linkword replace |
7776 | These 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 | |
7780 | This line sets the limits and the default for the priorities. All three | |
7781 | must be either letters A-Z or numbers 0-9. The highest priority must | |
7782 | have a lower ASCII number that the lowest priority. | |
7783 | @item #+PROPERTY: Property_Name Value | |
7784 | This line sets a default inheritance value for entries in the current | |
7785 | buffer, most useful for specifying the allowed values of a property. | |
7786 | @item #+STARTUP: | |
a7808fba CD |
7787 | This line sets options to be used at startup of Org mode, when an |
7788 | Org file is being visited. The first set of options deals with the | |
4009494e GM |
7789 | initial visibility of the outline tree. The corresponding variable for |
7790 | global default settings is @code{org-startup-folded}, with a default | |
7791 | value @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 | |
7796 | overview @r{top-level headlines only} | |
7797 | content @r{all headlines} | |
7798 | showall @r{no folding at all, show everything} | |
7799 | @end example | |
7800 | Then there are options for aligning tables upon visiting a file. This | |
7801 | is useful in files containing narrowed table columns. The corresponding | |
7802 | variable 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 | |
7807 | align @r{align all tables} | |
7808 | noalign @r{don't align tables on startup} | |
7809 | @end example | |
28a16a1b CD |
7810 | Logging 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 |
7822 | logdone @r{record a timestamp when an item is marked DONE} |
7823 | lognotedone @r{record timestamp and a note when DONE} | |
7824 | nologdone @r{don't record when items are marked DONE} | |
7825 | logrepeat @r{record a time when reinstating a repeating item} | |
7826 | lognoterepeat @r{record a note when reinstating a repeating item} | |
7827 | nologrepeat @r{do not record when reinstating repeating item} | |
7828 | lognoteclock-out @r{record a note when clocking out} | |
7829 | nolognoteclock-out @r{don't record a note when clocking out} | |
4009494e GM |
7830 | @end example |
7831 | Here are the options for hiding leading stars in outline headings. The | |
7832 | corresponding 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 | |
7840 | hidestars @r{make all but one of the stars starting a headline invisible.} | |
7841 | showstars @r{show all stars starting a headline} | |
7842 | odd @r{allow only odd outline levels (1,3,...)} | |
7843 | oddeven @r{allow all outline levels} | |
7844 | @end example | |
7845 | To 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 | |
7850 | customtime @r{overlay custom time format} | |
7851 | @end example | |
7852 | The 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 | |
7857 | constcgs @r{@file{constants.el} should use the c-g-s unit system} | |
7858 | constSI @r{@file{constants.el} should use the SI unit system} | |
7859 | @end example | |
7860 | @item #+TAGS: TAG1(c1) TAG2(c2) | |
cad1d376 | 7861 | These lines (several such lines are allowed) specify the valid tags in |
4009494e GM |
7862 | this file, and (potentially) the corresponding @emph{fast tag selection} |
7863 | keys. The corresponding variable is @code{org-tag-alist}. | |
7864 | @item #+TBLFM: | |
7865 | This line contains the formulas for the table directly above the line. | |
dbc28aaa | 7866 | @item #+TITLE:, #+AUTHOR:, #+EMAIL:, #+LANGUAGE:, #+TEXT:, #+OPTIONS, #+DATE: |
4009494e GM |
7867 | These lines provide settings for exporting files. For more details see |
7868 | @ref{Export options}. | |
7869 | @item #+SEQ_TODO: #+TYP_TODO: | |
7870 | These lines set the TODO keywords and their interpretation in the | |
7871 | current file. The corresponding variables are @code{org-todo-keywords} | |
7872 | and @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 | 7880 | The key @kbd{C-c C-c} has many purposes in Org, which are all |
4009494e GM |
7881 | mentioned scattered throughout this manual. One specific function of |
7882 | this key is to add @emph{tags} to a headline (@pxref{Tags}). In many | |
a7808fba | 7883 | other circumstances it means something like @emph{Hey Org, look |
4009494e GM |
7884 | here and update according to what you see here}. Here is a summary of |
7885 | what this means in different contexts. | |
7886 | ||
7887 | @itemize @minus | |
7888 | @item | |
7889 | If there are highlights in the buffer from the creation of a sparse | |
7890 | tree, or from clock display, remove these highlights. | |
7891 | @item | |
7892 | If the cursor is in one of the special @code{#+KEYWORD} lines, this | |
7893 | triggers scanning the buffer for these lines and updating the | |
28a16a1b | 7894 | information. |
4009494e GM |
7895 | @item |
7896 | If the cursor is inside a table, realign the table. This command | |
7897 | works even if the automatic table editor has been turned off. | |
7898 | @item | |
7899 | If the cursor is on a @code{#+TBLFM} line, re-apply the formulas to | |
7900 | the entire table. | |
7901 | @item | |
7902 | If the cursor is inside a table created by the @file{table.el} package, | |
7903 | activate that table. | |
7904 | @item | |
7905 | If the current buffer is a remember buffer, close the note and file it. | |
7906 | With a prefix argument, file it, without further interaction, to the | |
7907 | default location. | |
7908 | @item | |
7909 | If the cursor is on a @code{<<<target>>>}, update radio targets and | |
7910 | corresponding links in this buffer. | |
7911 | @item | |
7912 | If the cursor is in a property line or at the start or end of a property | |
7913 | drawer, offer property commands. | |
7914 | @item | |
7915 | If the cursor is in a plain list item with a checkbox, toggle the status | |
7916 | of the checkbox. | |
7917 | @item | |
7918 | If the cursor is on a numbered item in a plain list, renumber the | |
7919 | ordered list. | |
dbc28aaa CD |
7920 | @item |
7921 | If the cursor is on the @code{#+BEGIN} line of a dynamical block, the | |
7922 | block 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 | 7930 | Some people find it noisy and distracting that the Org headlines |
4009494e GM |
7931 | are starting with a potentially large number of stars. For example |
7932 | the 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 | 7945 | Unfortunately this is deeply ingrained into the code of Org and |
4009494e GM |
7946 | cannot be easily changed. You can, however, modify the display in such |
7947 | a way that all leading stars become invisible and the outline more easy | |
7948 | to 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 | |
7956 | or change this on a per-file basis with one of the lines (anywhere in | |
7957 | the buffer) | |
7958 | ||
7959 | @example | |
7960 | #+STARTUP: showstars | |
7961 | #+STARTUP: hidestars | |
7962 | @end example | |
7963 | ||
7964 | @noindent | |
7965 | Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate | |
7966 | the modifications. | |
7967 | ||
7968 | With 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 | |
7981 | Note that the leading stars are not truly replaced by whitespace, they | |
7982 | are only fontified with the face @code{org-hide} that uses the | |
7983 | background color as font color. If you are not using either white or | |
7984 | black background, you may have to customize this face to get the wanted | |
7985 | effect. Another possibility is to set this font such that the extra | |
7986 | stars are @i{almost} invisible, for example using the color | |
7987 | @code{grey90} on a white background. | |
7988 | ||
7989 | Things become cleaner still if you skip all the even levels and use only | |
7990 | odd levels 1, 3, 5..., effectively adding two stars to go from one | |
7991 | outline 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 | |
8004 | In order to make the structure editing and export commands handle this | |
8005 | convention correctly, use | |
8006 | ||
8007 | @lisp | |
8008 | (setq org-odd-levels-only t) | |
8009 | @end lisp | |
8010 | ||
8011 | @noindent | |
8012 | or set this on a per-file basis with one of the following lines (don't | |
8013 | forget to press @kbd{C-c C-c} with the cursor in the startup line to | |
8014 | activate changes immediately). | |
8015 | ||
8016 | @example | |
8017 | #+STARTUP: odd | |
8018 | #+STARTUP: oddeven | |
8019 | @end example | |
8020 | ||
a7808fba | 8021 | You can convert an Org file from single-star-per-level to the |
4009494e GM |
8022 | double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels |
8023 | RET} in that file. The reverse operation is @kbd{M-x | |
8024 | org-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 |
8030 | Because Org contains a large number of commands, by default much of |
8031 | Org's core commands are bound to keys that are generally not | |
dbc28aaa CD |
8032 | accessible 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 | |
8034 | together with modifiers like @key{Meta} and/or @key{Shift}. To access | |
8035 | these commands on a tty when special keys are unavailable, the following | |
8036 | alternative bindings can be used. The tty bindings below will likely be | |
8037 | more cumbersome; you may find for some of the bindings below that a | |
8038 | customized work-around suits you better. For example, changing a time | |
8039 | stamp is really only fun with @kbd{S-@key{cursor}} keys, whereas on a | |
8040 | tty 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 | 8067 | Org lives in the world of GNU Emacs and interacts in various ways |
4009494e GM |
8068 | with 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 |
8081 | Org uses the Calc package for implementing spreadsheet |
8082 | functionality in its tables (@pxref{The spreadsheet}). Org | |
8083 | checks for the availability of Calc by looking for the function | |
8084 | @code{calc-eval} which should be autoloaded in your setup if Calc has | |
8085 | been installed properly. As of Emacs 22, Calc is part of the Emacs | |
4009494e | 8086 | distribution. Another possibility for interaction between the two |
a7808fba CD |
8087 | packages 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 | |
8091 | In a table formula (@pxref{The spreadsheet}), it is possible to use | |
8092 | names for natural constants or units. Instead of defining your own | |
8093 | constants in the variable @code{org-table-formula-constants}, install | |
8094 | the @file{constants} package which defines a large number of constants | |
8095 | and 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 | 8097 | at @url{http://www.astro.uva.nl/~dominik/Tools}. Org checks for |
4009494e GM |
8098 | the function @code{constants-get}, which has to be autoloaded in your |
8099 | setup. 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 |
8103 | Org mode can make use of the CDLaTeX package to efficiently enter |
8104 | La@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 |
8107 | Imenu allows menu access to an index of items in a file. Org mode |
8108 | supports 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 |
8113 | By default the index is two levels deep - you can modify the depth using | |
8114 | the option @code{org-imenu-depth}. | |
4009494e GM |
8115 | @item @file{remember.el} by John Wiegley |
8116 | @cindex @file{remember.el} | |
a7808fba | 8117 | Org 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} | |
8121 | Speedbar is a package that creates a special frame displaying files and | |
a7808fba CD |
8122 | index items in files. Org mode supports Speedbar and allows you to |
8123 | drill into Org files directly from the Speedbar. It also allows to | |
dbc28aaa | 8124 | restrict the scope of agenda commands to a file or a subtree by using |
a7808fba | 8125 | the 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 | ||
8132 | Complex ASCII tables with automatic line wrapping, column- and | |
8133 | row-spanning, and alignment can be created using the Emacs table | |
8134 | package by Takaaki Ota (@uref{http://sourceforge.net/projects/table}, | |
8135 | and also part of Emacs 22). | |
a7808fba | 8136 | When @key{TAB} or @kbd{C-c C-c} is pressed in such a table, Org mode |
4009494e | 8137 | will call @command{table-recognize-table} and move the cursor into the |
a7808fba CD |
8138 | table. Inside a table, the keymap of Org mode is inactive. In order |
8139 | to 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 | |
8144 | Recognize @file{table.el} table. Works when the cursor is in a | |
8145 | table.el table. | |
8146 | @c | |
8147 | @kindex C-c ~ | |
8148 | @item C-c ~ | |
8149 | Insert a table.el table. If there is already a table at point, this | |
a7808fba | 8150 | command converts it between the table.el format and the Org mode |
4009494e GM |
8151 | format. See the documentation string of the command |
8152 | @code{org-convert-table} for the restrictions under which this is | |
8153 | possible. | |
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 | 8158 | Org 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 | 8169 | Startup of Org may fail with the error message |
4009494e GM |
8170 | @code{(wrong-type-argument keymapp nil)} when there is an outdated |
8171 | version @file{allout.el} on the load path, for example the version | |
8172 | distributed with Emacs 21.x. Upgrade to Emacs 22 and this problem will | |
8173 | disappear. If for some reason you cannot do this, make sure that org.el | |
8174 | is 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 |
8179 | Key bindings in Org conflict with the @kbd{S-<cursor>} keys used by |
8180 | CUA mode (as well as pc-select-mode and s-region-mode) to select and | |
dbc28aaa | 8181 | extend the region. If you want to use one of these packages along with |
a7808fba CD |
8182 | Org, configure the variable @code{org-replace-disputed-keys}. When |
8183 | set, Org will move the following key bindings in Org files, and | |
dbc28aaa | 8184 | in the agenda buffer (but not during date selection). |
4009494e GM |
8185 | |
8186 | @example | |
8187 | S-UP -> M-p S-DOWN -> M-n | |
8188 | S-LEFT -> M-- S-RIGHT -> M-+ | |
8189 | @end example | |
8190 | ||
8191 | Yes, these are unfortunately more difficult to remember. If you want | |
8192 | to 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} | |
8196 | Also this package uses the @kbd{S-<cursor>} keys, so everything written | |
8197 | in 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 | 8201 | Org supports the syntax of the footnote package, but only the |
4009494e | 8202 | numerical footnote markers. Also, the default key for footnote |
a7808fba | 8203 | commands, @kbd{C-c !} is already used by Org. You could use the |
4009494e GM |
8204 | variable @code{footnote-prefix} to switch footnotes commands to another |
8205 | key. 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 | ||
8215 | Here is a list of things that should work differently, but which I | |
8216 | have found too hard to fix. | |
8217 | ||
8218 | @itemize @bullet | |
8219 | @item | |
8220 | If a table field starts with a link, and if the corresponding table | |
8221 | column is narrowed (@pxref{Narrow columns}) to a width too small to | |
8222 | display the link, the field would look entirely empty even though it is | |
a7808fba | 8223 | not. To prevent this, Org throws an error. The work-around is to |
4009494e GM |
8224 | make the column wide enough to fit the link, or to add some text (at |
8225 | least 2 characters) before the link in the same field. | |
8226 | @item | |
8227 | Narrowing table columns does not work on XEmacs, because the | |
8228 | @code{format} function does not transport text properties. | |
8229 | @item | |
8230 | Text in an entry protected with the @samp{QUOTE} keyword should not | |
8231 | autowrap. | |
8232 | @item | |
8233 | When 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 | |
8235 | the file), it does so silently. No error message is displayed. | |
8236 | @item | |
8237 | Recalculating a table line applies the formulas from left to right. | |
8238 | If a formula uses @emph{calculated} fields further down the row, | |
8239 | multiple recalculation may be needed to get all fields consistent. You | |
8240 | may use the command @code{org-table-iterate} (@kbd{C-u C-c *}) to | |
8241 | recalculate until convergence. | |
8242 | @item | |
8243 | A single letter cannot be made bold, for example @samp{*a*}. | |
8244 | @item | |
8245 | The 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 | 8252 | This appendix lists extensions for Org written by other authors. |
4009494e | 8253 | It also covers some aspects where users can extend the functionality of |
a7808fba | 8254 | Org. |
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 |
8269 | There are lots of extensions that have been written by other people. Most of |
8270 | them have either been integrated into Org by now, or they can be found in the | |
8271 | Org distribution, in the @file{contrib} directory. The list has gotten too | |
8272 | long to cover in any detail here, but there is a seaparate manual for these | |
8273 | extensions. | |
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 | 8279 | Org has a large number of hyperlink types built-in |
4009494e GM |
8280 | (@pxref{Hyperlinks}). If you would like to add new link types, it |
8281 | provides 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 |
8284 | emacs: |
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. | |
8301 | PATH 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 | |
8329 | You would activate this new link type in @file{.emacs} with | |
8330 | ||
8331 | @lisp | |
8332 | (require 'org-man) | |
8333 | @end lisp | |
8334 | ||
8335 | @noindent | |
8336 | Lets go through the file and see what it does. | |
8337 | @enumerate | |
28a16a1b | 8338 | @item |
4009494e GM |
8339 | It does @code{(require 'org)} to make sure that @file{org.el} has been |
8340 | loaded. | |
8341 | @item | |
8342 | The next line calls @code{org-add-link-type} to define a new link type | |
8343 | with prefix @samp{man}. The call also contains the name of a function | |
8344 | that will be called to follow such a link. | |
8345 | @item | |
8346 | The next line adds a function to @code{org-store-link-functions}, in | |
8347 | order to allow the command @kbd{C-c l} to record a useful link in a | |
8348 | buffer displaying a man page. | |
8349 | @end enumerate | |
8350 | ||
8351 | The rest of the file defines the necessary variables and functions. | |
8352 | First there is a customization variable that determines which emacs | |
a7808fba | 8353 | command 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 |
8355 | defined. It gets the link path as an argument - in this case the link | |
8356 | path is just a topic for the manual command. The function calls the | |
8357 | value of @code{org-man-command} to display the man page. | |
8358 | ||
8359 | Finally the function @code{org-man-store-link} is defined. When you try | |
8360 | to store a link with @kbd{C-c l}, also this function will be called to | |
8361 | try to make a link. The function must first decide if it is supposed to | |
8362 | create the link for this buffer type, we do this by checking the value | |
8363 | of the variable @code{major-mode}. If not, the function must exit and | |
a7808fba CD |
8364 | return the value @code{nil}. If yes, the link is created by getting the |
8365 | manual 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} |
8367 | and set the @code{:type} and @code{:link} properties. Optionally you | |
8368 | can also set the @code{:description} property to provide a default for | |
a7808fba | 8369 | the link description when the link is later inserted into an Org |
4009494e GM |
8370 | buffer 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 | 8378 | Since Orgtbl mode can be used as a minor mode in arbitrary buffers, a |
4009494e | 8379 | frequent feature request has been to make it work with native tables in |
dbc28aaa CD |
8380 | specific languages, for example La@TeX{}. However, this is extremely |
8381 | hard to do in a general way, would lead to a customization nightmare, | |
a7808fba | 8382 | and would take away much of the simplicity of the Orgtbl mode table |
dbc28aaa CD |
8383 | editor. |
8384 | ||
4009494e | 8385 | |
a7808fba | 8386 | This appendix describes a different approach. We keep the Orgtbl mode |
4009494e GM |
8387 | table in its native format (the @i{source table}), and use a custom |
8388 | function 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 | |
8390 | the burden of writing conversion functions on the user, but it allows | |
8391 | for a very flexible system. | |
8392 | ||
dbc28aaa CD |
8393 | Bastien added the ability to do the same with lists. You can use Org's |
8394 | facilities to edit and structure lists by turning @code{orgstruct-mode} | |
8395 | on, then locally exporting such lists in another format (HTML, La@TeX{} | |
a7808fba | 8396 | or 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 | ||
8410 | To define the location of the target table, you first need to create two | |
8411 | lines that are comments in the current mode, but contain magic words for | |
a7808fba | 8412 | Orgtbl mode to find. Orgtbl mode will insert the translated table |
4009494e GM |
8413 | between 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 | |
8421 | Just above the source table, we put a special line that tells | |
a7808fba | 8422 | Orgtbl mode how to translate this table and where to install it. For |
4009494e GM |
8423 | example: |
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 | |
8430 | in the receiver lines. @code{translation_function} is the Lisp function | |
8431 | that does the translation. Furthermore, the line can contain a list of | |
8432 | arguments (alternating key and value) at the end. The arguments will be | |
8433 | passed as a property list to the translation function for | |
8434 | interpretation. A few standard parameters are already recognized and | |
8435 | acted upon before the translation function is called: | |
8436 | ||
8437 | @table @code | |
8438 | @item :skip N | |
8439 | Skip the first N lines of the table. Hlines do count! | |
8440 | @item :skipcols (n1 n2 ...) | |
8441 | List of columns that should be skipped. If the table has a column with | |
8442 | calculation marks, that column is automatically discarded as well. | |
8443 | Please note that the translator function sees the table @emph{after} the | |
8444 | removal of these columns, the function never knows that there have been | |
8445 | additional columns. | |
8446 | @end table | |
8447 | ||
8448 | @noindent | |
8449 | The one problem remaining is how to keep the source table in the buffer | |
8450 | without disturbing the normal workings of the file, for example during | |
8451 | compilation of a C file or processing of a La@TeX{} file. There are a | |
8452 | number of different solutions: | |
8453 | ||
8454 | @itemize @bullet | |
8455 | @item | |
8456 | The table could be placed in a block comment if that is supported by the | |
a7808fba | 8457 | language. For example, in C mode you could wrap the table between |
4009494e | 8458 | @samp{/*} and @samp{*/} lines. |
28a16a1b | 8459 | @item |
4009494e GM |
8460 | Sometimes it is possible to put the table after some kind of @i{END} |
8461 | statement, for example @samp{\bye} in TeX and @samp{\end@{document@}} | |
8462 | in La@TeX{}. | |
8463 | @item | |
8464 | You can just comment the table line by line whenever you want to process | |
8465 | the file, and uncomment it whenever you need to edit the table. This | |
8466 | only sounds tedious - the command @kbd{M-x orgtbl-toggle-comment} does | |
8467 | make this comment-toggling very easy, in particular if you bind it to a | |
8468 | key. | |
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 | |
8475 | The 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 | |
8477 | activated by placing @code{\usepackage@{comment@}} into the document | |
a7808fba CD |
8478 | header. Orgtbl mode can insert a radio table skeleton@footnote{By |
8479 | default this works only for La@TeX{}, HTML, and Texinfo. Configure the | |
4009494e GM |
8480 | variable @code{orgtbl-radio-tables} to install templates for other |
8481 | modes.} with the command @kbd{M-x orgtbl-insert-radio-table}. You will | |
8482 | be prompted for a table name, lets say we use @samp{salesfigures}. You | |
8483 | will 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 | 8495 | The @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 |
8497 | into the receiver location with name @code{salesfigures}. You may now | |
8498 | fill in the table, feel free to use the spreadsheet features@footnote{If | |
8499 | the @samp{#+TBLFM} line contains an odd number of dollar characters, | |
a7808fba | 8500 | this may cause problems with font-lock in LaTeX mode. As shown in the |
4009494e GM |
8501 | example you can fix this by adding an extra line inside the |
8502 | @code{comment} environment that is used to balance the dollar | |
8503 | expressions. If you are using AUCTeX with the font-latex library, a | |
8504 | much better solution is to add the @code{comment} environment to the | |
8505 | variable @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 | |
8523 | When you are done, press @kbd{C-c C-c} in the table to get the converted | |
8524 | table inserted between the two marker lines. | |
8525 | ||
8526 | Now lets assume you want to make the table header by hand, because you | |
8527 | want to control how columns are aligned etc. In this case we make sure | |
8528 | that the table translator does skip the first 2 lines of the source | |
8529 | table, and tell the command to work as a @i{splice}, i.e. to not produce | |
8530 | header and footer commands of the target table: | |
8531 | ||
8532 | @example | |
8533 | \begin@{tabular@}@{lrrr@} | |
8534 | Month & \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 | ||
8550 | The La@TeX{} translator function @code{orgtbl-to-latex} is already part of | |
a7808fba | 8551 | Orgtbl mode. It uses a @code{tabular} environment to typeset the table |
4009494e GM |
8552 | and marks horizontal lines with @code{\hline}. Furthermore, it |
8553 | interprets the following parameters: | |
8554 | ||
8555 | @table @code | |
8556 | @item :splice nil/t | |
8557 | When set to t, return only table body lines, don't wrap them into a | |
8558 | tabular environment. Default is nil. | |
8559 | ||
8560 | @item :fmt fmt | |
8561 | A format to be used to wrap each field, should contain @code{%s} for the | |
8562 | original field value. For example, to wrap each field value in dollars, | |
8563 | you could use @code{:fmt "$%s$"}. This may also be a property list with | |
8564 | column numbers and formats. for example @code{:fmt (2 "$%s$" 4 "%s\\%%")}. | |
a7808fba CD |
8565 | A function of one argument can be used in place of the strings; the |
8566 | function must return a formatted string. | |
4009494e GM |
8567 | |
8568 | @item :efmt efmt | |
8569 | Use this format to print numbers with exponentials. The format should | |
8570 | have @code{%s} twice for inserting mantissa and exponent, for example | |
8571 | @code{"%s\\times10^@{%s@}"}. The default is @code{"%s\\,(%s)"}. This | |
8572 | may 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 |
8575 | applied. Similar to @code{fmt}, functions of two arguments can be |
8576 | supplied 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 | 8584 | Orgtbl 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 | |
8587 | HTML translator uses the same code that produces tables during HTML | |
8588 | export.}, these all use a generic translator, @code{orgtbl-to-generic}. | |
8589 | For example, @code{orgtbl-to-latex} itself is a very short function that | |
8590 | computes the column definitions for the @code{tabular} environment, | |
8591 | defines a few field and line separators and then hands over to the | |
8592 | generic 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 | ||
8610 | As 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 | |
8613 | ones set by the @samp{ORGTBL SEND} line) take precedence. So if you | |
8614 | would like to use the La@TeX{} translator, but wanted the line endings to | |
8615 | be @samp{\\[2mm]} instead of the default @samp{\\}, you could just | |
8616 | overrule the default with | |
8617 | ||
8618 | @example | |
8619 | #+ORGTBL: SEND test orgtbl-to-latex :lend " \\\\[2mm]" | |
8620 | @end example | |
8621 | ||
8622 | For a new language, you can either write your own converter function in | |
8623 | analogy with the La@TeX{} translator, or you can use the generic function | |
8624 | directly. For example, if you have a language where a table is started | |
8625 | with @samp{!BTBL!}, ended with @samp{!ETBL!}, and where table lines are | |
8626 | started with @samp{!BL!}, ended with @samp{!EL!} and where the field | |
8627 | separator is a TAB, you could call the generic translator like this (on | |
8628 | a 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 | |
8636 | Please check the documentation string of the function | |
8637 | @code{orgtbl-to-generic} for a full list of parameters understood by | |
8638 | that function and remember that you can pass each of them into | |
8639 | @code{orgtbl-to-latex}, @code{orgtbl-to-texinfo}, and any other function | |
8640 | using the generic function. | |
8641 | ||
8642 | Of course you can also write a completely new function doing complicated | |
8643 | things the generic translator cannot do. A translator function takes | |
8644 | two arguments. The first argument is the table, a list of lines, each | |
8645 | line either the symbol @code{hline} or a list of fields. The second | |
8646 | argument is the property list containing all parameters specified in the | |
8647 | @samp{#+ORGTBL: SEND} line. The function must return a single string | |
8648 | containing the formatted table. If you write a generally useful | |
8649 | translator, please post it on @code{emacs-orgmode@@gnu.org} so that | |
8650 | others 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 | ||
8657 | Sending and receiving radio lists works exactly the same way than | |
8658 | sending and receiving radio tables (@pxref{Radio tables}) @footnote{You | |
8659 | need to load the @code{org-export-latex.el} package to use radio lists | |
8660 | since the relevant code is there for now.}. As for radio tables, you | |
a7808fba | 8661 | can insert radio lists templates in HTML, La@TeX{} and Texinfo modes by |
dbc28aaa CD |
8662 | calling @code{org-list-insert-radio-list}. |
8663 | ||
8664 | Here are the differences with radio tables: | |
8665 | ||
8666 | @itemize @minus | |
8667 | @item | |
8668 | Use @code{ORGLST} instead of @code{ORGTBL}. | |
8669 | @item | |
8670 | The available translation functions for radio lists don't take | |
8671 | parameters. | |
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 | ||
8676 | Here is a La@TeX{} example. Let's say that you have this in your | |
8677 | La@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 | ||
8692 | Pressing `C-c C-c' on @code{a new house} and will insert the converted | |
8693 | La@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 | 8699 | Org documents can contain @emph{dynamic blocks}. These are |
4009494e GM |
8700 | specially marked regions that are updated by some user-written function. |
8701 | A good example for such a block is the clock table inserted by the | |
8702 | command @kbd{C-c C-x C-r} (@pxref{Clocking work time}). | |
8703 | ||
8704 | Dynamic block are enclosed by a BEGIN-END structure that assigns a name | |
8705 | to the block and can also specify parameters for the function producing | |
8706 | the content of the block. | |
8707 | ||
8708 | @example | |
8709 | #+BEGIN: myblock :parameter1 value1 :parameter2 value2 ... | |
8710 | ||
8711 | #+END: | |
8712 | @end example | |
8713 | ||
8714 | Dynamic 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 | |
8719 | Update dynamic block at point. | |
8720 | @kindex C-u C-c C-x C-u | |
8721 | @item C-u C-c C-x C-u | |
8722 | Update all dynamic blocks in the current file. | |
8723 | @end table | |
8724 | ||
8725 | Updating a dynamic block means to remove all the text between BEGIN and | |
8726 | END, parse the BEGIN line for parameters and then call the specific | |
28a16a1b CD |
8727 | writer function for this block to insert the new content. If you want |
8728 | to use the original content in the writer function, you can use the | |
8729 | extra parameter @code{:content}. | |
8730 | ||
8731 | For 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 |
8733 | with the parameters given in the begin line. Here is a trivial example | |
8734 | of a block that keeps track of when the block update function was last | |
8735 | run: | |
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 | |
8744 | The 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 | ||
8753 | If you want to make sure that all dynamic blocks are always up-to-date, | |
8754 | you could add the function @code{org-update-all-dblocks} to a hook, for | |
8755 | example @code{before-save-hook}. @code{org-update-all-dblocks} is | |
a7808fba CD |
8756 | written 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 | 8763 | Org provides a special hook that can be used to narrow down the |
4009494e GM |
8764 | selection made by any of the agenda views. You may specify a function |
8765 | that is used at each match to verify if the match should indeed be part | |
8766 | of the agenda view, and if not, how much should be skipped. | |
8767 | ||
8768 | Let's say you want to produce a list of projects that contain a WAITING | |
8769 | tag anywhere in the project tree. Let's further assume that you have | |
a7808fba CD |
8770 | marked all tree headings that define a project with the TODO keyword |
8771 | PROJECT. In this case you would run a TODO search for the keyword | |
4009494e GM |
8772 | PROJECT, but skip the match unless there is a WAITING tag anywhere in |
8773 | the subtree belonging to the project line. | |
8774 | ||
8775 | To achieve this, you must write a function that searches the subtree for | |
8776 | the tag. If the tag is found, the function must return @code{nil} to | |
8777 | indicate that this match should not be skipped. If there is no such | |
8778 | tag, return the location of the end of the subtree, to indicate that | |
8779 | search 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 | ||
8790 | Now you may use this function in an agenda custom command, for example | |
8791 | like 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 | ||
8800 | Note that this also binds @code{org-agenda-overriding-header} to get a | |
8801 | meaningful header in the agenda view. | |
8802 | ||
a7808fba CD |
8803 | A general way to create custom searches is to base them on a search for |
8804 | entries with a certain level limit. If you want to study all entries with | |
8805 | your custom search function, simply do a search for @samp{LEVEL>0}, and then | |
8806 | use @code{org-agenda-skip-function} to select the entries you really want to | |
8807 | have. | |
8808 | ||
4009494e GM |
8809 | You may also put a Lisp form into @code{org-agenda-skip-function}. In |
8810 | particular, you may use the functions @code{org-agenda-skip-entry-if} | |
8811 | and @code{org-agenda-skip-subtree-if} in this form, for example: | |
8812 | ||
8813 | @table @code | |
8814 | @item '(org-agenda-skip-entry-if 'scheduled) | |
8815 | Skip current entry if it has been scheduled. | |
8816 | @item '(org-agenda-skip-entry-if 'notscheduled) | |
8817 | Skip current entry if it has not been scheduled. | |
8818 | @item '(org-agenda-skip-entry-if 'deadline) | |
8819 | Skip current entry if it has a deadline. | |
8820 | @item '(org-agenda-skip-entry-if 'scheduled 'deadline) | |
8821 | Skip current entry if it has a deadline, or if it is scheduled. | |
8822 | @item '(org-agenda-skip-entry 'regexp "regular expression") | |
dbc28aaa CD |
8823 | Skip current entry if the regular expression matches in the entry. |
8824 | @item '(org-agenda-skip-entry 'notregexp "regular expression") | |
8825 | Skip current entry unless the regular expression matches. | |
4009494e GM |
8826 | @item '(org-agenda-skip-subtree-if 'regexp "regular expression") |
8827 | Same as above, but check and skip the entire subtree. | |
8828 | @end table | |
8829 | ||
8830 | Therefore we could also have written the search for WAITING projects | |
8831 | like 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 | ||
8846 | Here is a description of the functions that can be used to work with | |
8847 | properties. | |
8848 | ||
8849 | @defun org-entry-properties &optional pom which | |
8850 | Get all properties of the entry at point-or-marker POM. | |
8851 | This includes the TODO keyword, the tags, time strings for deadline, | |
8852 | scheduled, and clocking, and any additional properties defined in the | |
8853 | entry. The return value is an alist, keys may occur multiple times | |
8854 | if the property key was used several times. | |
8855 | POM may also be nil, in which case the current entry is used. | |
8856 | If 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 |
8860 | Get value of PROPERTY for entry at point-or-marker POM. By default, |
8861 | this only looks at properties defined locally in the entry. If INHERIT | |
8862 | is non-nil and the entry does not have the property, then also check | |
8863 | higher 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 | |
8869 | Delete the property PROPERTY from entry at point-or-marker POM. | |
8870 | @end defun | |
8871 | ||
8872 | @defun org-entry-put pom property value | |
8873 | Set PROPERTY to VALUE for entry at point-or-marker POM. | |
8874 | @end defun | |
8875 | ||
8876 | @defun org-buffer-property-keys &optional include-specials | |
8877 | Get all property keys in the current buffer. | |
8878 | @end defun | |
8879 | ||
8880 | @defun org-insert-property-drawer | |
8881 | Insert a property drawer at point. | |
8882 | @end defun | |
8883 | ||
a7808fba CD |
8884 | @defun org-entry-add-to-multivalued-property pom property value |
8885 | Treat the value of the property PROPERTY as a whitespace-separated list of | |
8886 | values and make sure that VALUE is in this list. | |
8887 | @end defun | |
8888 | ||
8889 | @defun org-entry-remove-from-multivalued-property pom property value | |
8890 | Treat the value of the property PROPERTY as a whitespace-separated list of | |
8891 | values 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 | |
8895 | Treat the value of the property PROPERTY as a whitespace-separated list of | |
8896 | values 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 |
8905 | Org was borne in 2003, out of frustration over the user interface |
8906 | of the Emacs Outline mode. I was trying to organize my notes and | |
4009494e GM |
8907 | projects, and using Emacs seemed to be the natural way to go. However, |
8908 | having to remember eleven different commands with two or three keys per | |
a7808fba | 8909 | command, only to hide and show parts of the outline tree, that seemed |
4009494e GM |
8910 | entirely unacceptable to me. Also, when using outlines to take notes, I |
8911 | constantly want to restructure the tree, organizing it parallel to my | |
8912 | thoughts and plans. @emph{Visibility cycling} and @emph{structure | |
8913 | editing} 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 | |
8916 | planning, the next step was adding @emph{TODO entries}, basic @emph{time | |
8917 | stamps}, and @emph{table support}. These areas highlight the two main | |
a7808fba | 8918 | goals that Org still has today: To create a new, outline-based, |
4009494e GM |
8919 | plain text mode with innovative and intuitive editing features, and to |
8920 | incorporate project planning functionality directly into a notes file. | |
8921 | ||
a7808fba CD |
8922 | A special thanks goes to @i{Bastien Guerry} who has not only writen a large |
8923 | number of extensions to Org (most of them integrated into the core by now), | |
8924 | but has also helped the development and maintenance of Org so much that he | |
8925 | should be considered co-author of this package. | |
8926 | ||
4009494e GM |
8927 | Since the first release, literally thousands of emails to me or on |
8928 | @code{emacs-orgmode@@gnu.org} have provided a constant stream of bug | |
8929 | reports, feedback, new ideas, and sometimes patches and add-on code. | |
8930 | Many thanks to everyone who has helped to improve this package. I am | |
8931 | trying to keep here a list of the people who had significant influence | |
a7808fba | 8932 | in shaping one or more aspects of Org. The list may not be |
4009494e GM |
8933 | complete, if I have forgotten someone, please accept my apologies and |
8934 | let 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 | |
8946 | for Remember. | |
8947 | @item | |
8948 | @i{Pavel Chalmoviansky} influenced the agenda treatment of items with | |
8949 | specified time. | |
8950 | @item | |
8951 | @i{Gregory Chernov} patched support for lisp forms into table | |
8952 | calculations 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 | |
8958 | came up with the idea of properties, and that there should be an API for | |
8959 | them. | |
8960 | @item | |
8961 | @i{Kees Dullemond} used to edit projects lists directly in HTML and so | |
8962 | inspired some of the early development, including HTML export. He also | |
8963 | asked for a way to narrow wide table columns. | |
8964 | @item | |
a7808fba | 8965 | @i{Christian Egli} converted the documentation into Texinfo format, |
4009494e GM |
8966 | patched 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 | |
8969 | HTML 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 |
8976 | around 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 |
8981 | has 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, |
8986 | task state change logging, and the clocktable. His clear explanations have | |
8987 | been 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 |
8992 | folded 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 |
8997 | provided 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 |
9004 | basis. | |
9005 | @item | |
9006 | @i{Stefan Monnier} provided a patch to keep the Emacs-Lisp compiler | |
9007 | happy. | |
9008 | @item | |
dbc28aaa CD |
9009 | @i{Rick Moynihan} proposed to allow multiple TODO sequences in a file |
9010 | and 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 | |
9015 | file links, and TAGS. | |
9016 | @item | |
9017 | @i{Takeshi Okano} translated the manual and David O'Toole's tutorial | |
9018 | into 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 | |
9023 | links, among other things. | |
9024 | @item | |
9025 | @i{Pete Phillips} helped during the development of the TAGS feature, and | |
9026 | provided 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 | |
9031 | control. | |
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 |
9036 | webpages derived from Org using an Info-like, or a folding interface with | |
9037 | single key navigation. | |
9038 | @item | |
4009494e GM |
9039 | @i{Frank Ruell} solved the mystery of the @code{keymapp nil} bug, a |
9040 | conflict 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 |
9045 | of feedback. |
9046 | @item | |
9047 | @i{Christian Schlauer} proposed angular brackets around links, among | |
9048 | other things. | |
9049 | @item | |
a7808fba | 9050 | Linking 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 |
9056 | subtrees. | |
9057 | @item | |
9058 | @i{Dale Smith} proposed link abbreviations. | |
9059 | @item | |
9060 | @i{Adam Spiers} asked for global linking commands and inspired the link | |
9061 | extension system. support mairix. | |
9062 | @item | |
9063 | @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual | |
9064 | chapter about publishing. | |
9065 | @item | |
9066 | @i{J@"urgen Vollmer} contributed code generating the table of contents | |
9067 | in HTML output. | |
9068 | @item | |
9069 | @i{Chris Wallace} provided a patch implementing the @samp{QUOTE} | |
9070 | keyword. | |
9071 | @item | |
9072 | @i{David Wainberg} suggested archiving, and improvements to the linking | |
9073 | system. | |
9074 | @item | |
9075 | @i{John Wiegley} wrote @file{emacs-wiki.el} and @file{planner.el}. The | |
a7808fba CD |
9076 | development of Org was fully independent, and both systems are really |
9077 | different beasts in their basic ideas and implementation details. I later | |
9078 | looked at John's code, however, and learned from his implementation of (i) | |
9079 | links 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 | |
9081 | number 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 | 9085 | linking to Gnus. |
4009494e | 9086 | @item |
a7808fba | 9087 | @i{Roland Winkler} requested additional key bindings to make Org |
4009494e GM |
9088 | work on a tty. |
9089 | @item | |
9090 | @i{Piotr Zielinski} wrote @file{org-mouse.el}, proposed agenda blocks | |
9091 | and 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: |