org.el 469 KB
Newer Older
1
;;; org.el --- Outline-based notes management and organize
2
;; Carstens outline-mode for keeping track of everything.
3
;; Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
4
;;
Richard M. Stallman's avatar
Richard M. Stallman committed
5
;; Author: Carsten Dominik <dominik at science dot uva dot nl>
6
;; Keywords: outlines, hypermedia, calendar, wp
Richard M. Stallman's avatar
Richard M. Stallman committed
7
;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
8
;; Version: 4.09
9
;;
Richard M. Stallman's avatar
Richard M. Stallman committed
10
;; This file is part of GNU Emacs.
11
;;
Richard M. Stallman's avatar
Richard M. Stallman committed
12 13 14
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
Richard M. Stallman's avatar
Richard M. Stallman committed
15 16
;; any later version.

Richard M. Stallman's avatar
Richard M. Stallman committed
17 18 19 20
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
Richard M. Stallman's avatar
Richard M. Stallman committed
21 22 23

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to the
24 25
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
Richard M. Stallman's avatar
Richard M. Stallman committed
26 27 28 29 30 31 32 33
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing
;; project planning with a fast and effective plain-text system.
;;
;; Org-mode develops organizational tasks around a NOTES file that contains
34 35 36 37 38 39 40 41 42
;; information about projects as plain text.  Org-mode is implemented on top
;; of outline-mode - ideal to keep the content of large files well structured.
;; It supports ToDo items, deadlines and time stamps, which can be extracted
;; to create a daily/weekly agenda that also integrates the diary of the Emacs
;; calendar.  Tables are easily created with a built-in table editor.  Plain
;; text URL-like links connect to websites, emails (VM, RMAIL, WANDERLUST),
;; Usenet messages (Gnus), BBDB entries, and any files related to the
;; projects.  For printing and sharing of notes, an Org-mode file (or a part
;; of it) can be exported as a structured ASCII file, or as HTML.
Richard M. Stallman's avatar
Richard M. Stallman committed
43 44 45
;;
;; Installation
;; ------------
46 47 48 49
;; If Org-mode is part of the Emacs distribution or an XEmacs package, you
;; only need to copy the following lines to your .emacs file.  The last two
;; lines define *global* keys for the commands `org-store-link' and
;; `org-agenda' - please choose suitable keys yourself.
Richard M. Stallman's avatar
Richard M. Stallman committed
50
;;
51 52 53 54 55 56 57
;;    (add-to-list 'auto-mode-alist '("\\.org$" . org-mode))
;;    (define-key global-map "\C-cl" 'org-store-link)
;;    (define-key global-map "\C-ca" 'org-agenda)
;;
;; If you have downloaded Org-mode from the Web, you must byte-compile
;; org.el and put it on your load path.  In addition to the Emacs Lisp
;; lines above, you also need to add the following lines to .emacs:
Richard M. Stallman's avatar
Richard M. Stallman committed
58 59 60 61 62
;;
;;    (autoload 'org-mode "org" "Org mode" t)
;;    (autoload 'org-diary "org" "Diary entries from Org mode")
;;    (autoload 'org-agenda "org" "Multi-file agenda from Org mode" t)
;;    (autoload 'org-store-link "org" "Store a link to the current location" t)
63 64
;;    (autoload 'orgtbl-mode "org" "Org tables as a minor mode" t)
;;    (autoload 'turn-on-orgtbl "org" "Org tables as a minor mode")
Richard M. Stallman's avatar
Richard M. Stallman committed
65
;;
66 67
;; This setup will put all files with extension ".org" into Org-mode.  As
;; an alternative, make the first line of a file look like this:
Richard M. Stallman's avatar
Richard M. Stallman committed
68 69 70 71 72 73 74 75
;;
;;     MY PROJECTS    -*- mode: org; -*-
;;
;; which will select Org-mode for this buffer no matter what the file's
;; name is.
;;
;; Documentation
;; -------------
76 77 78
;; The documentation of Org-mode can be found in the TeXInfo file.  The
;; distribution also contains a PDF version of it.  At the homepage of
;; Org-mode, you can read the same text online as HTML.  There is also an
79 80
;; excellent reference card made by Philip Rooke.  This card can be found
;; in the etc/ directory of Emacs 22.
Richard M. Stallman's avatar
Richard M. Stallman committed
81
;;
82 83
;; Changes since version 4.00:
;; ---------------------------
84 85 86 87
;; Version 4.09
;;    - Bug fixes.
;;    - Small improvements to font-lock support.
;;    - MHE support finalized.
88
;;
89 90 91
;; Version 4.08
;;    - Bug fixes.
;;    - Improved MHE support
92
;;
93 94 95 96 97 98
;; Version 4.07
;;    - Bug fixes.
;;    - Leading stars in headlines can be hidden, so make the outline look
;;      cleaner.
;;    - Mouse-1 can be used to follow links.
;;     
99 100 101 102
;; Version 4.06
;;    - HTML exporter treats targeted internal links.
;;    - Bug fixes.
;;
103 104 105 106 107 108 109 110 111 112 113
;; Version 4.05
;;    - Changes to internal link system (thanks to David Wainberg for ideas).
;;      - in-file links: [[Search String]] instead of <file:::Search String>
;;      - automatic links to "radio targets".
;;      - CamelCase not longer active by default, configure org-activate-camels
;;        if you want to turn it back on.
;;      - After following a link, `C-c &' jumps back to it.
;;    - MH-E link support (thanks to Thomas Baumann).
;;    - Special table lines are no longer exported.
;;    - Bug fixes and minor improvements.
;;
114 115 116 117
;; Version 4.04
;;    - Cleanup tags display in agenda.
;;    - Bug fixes.
;;
118 119 120 121 122 123
;; Version 4.03
;;    - Table alignment fixed for use with wide characters.
;;    - `C-c -' leaves cursor in current table line.
;;    - The current TAG can be incorporated into the agenda prefix.
;;      See option `org-agenda-prefix-format' for details.
;;
124 125 126 127
;; Version 4.02
;;    - Minor bug fixes and improvements around tag searches.
;;    - XEmacs compatibility fixes.
;;
128 129 130 131 132 133 134
;; Version 4.01
;;    - Tags can also be set remotely from agenda buffer.
;;    - Boolean logic for tag searches.
;;    - Additional agenda commands can be configured through the variable
;;      `org-agenda-custom-commands'.
;;    - Minor bug fixes.
;;
Richard M. Stallman's avatar
Richard M. Stallman committed
135 136
;;; Code:

137
(eval-when-compile (require 'cl) (require 'calendar))
Richard M. Stallman's avatar
Richard M. Stallman committed
138 139 140 141
(require 'outline)
(require 'time-date)
(require 'easymenu)

142 143 144 145
(defvar calc-embedded-close-formula)
(defvar calc-embedded-open-formula)
(defvar font-lock-unfontify-region-function)

Richard M. Stallman's avatar
Richard M. Stallman committed
146 147
;;; Customization variables

148
(defvar org-version "4.09"
Richard M. Stallman's avatar
Richard M. Stallman committed
149
  "The version number of the file org.el.")
150 151
(defun org-version ()
  (interactive)
Richard M. Stallman's avatar
Richard M. Stallman committed
152 153
  (message "Org-mode version %s" org-version))

154 155 156
;; The following two constants are for compatibility with different Emacs
;; versions (Emacs versus XEmacs) and with different versions of outline.el.
;; The compatibility code in org.el is based on these two constants.
Richard M. Stallman's avatar
Richard M. Stallman committed
157
(defconst org-xemacs-p (featurep 'xemacs)
158
  "Are we running XEmacs?")
Richard M. Stallman's avatar
Richard M. Stallman committed
159 160 161 162
(defconst org-noutline-p (featurep 'noutline)
  "Are we using the new outline mode?")

(defgroup org nil
163
  "Outline-based notes management and organizer."
Richard M. Stallman's avatar
Richard M. Stallman committed
164 165 166 167 168 169 170 171 172 173
  :tag "Org"
  :group 'outlines
  :group 'hypermedia
  :group 'calendar)

(defgroup org-startup nil
  "Options concerning startup of Org-mode."
  :tag "Org Startup"
  :group 'org)

174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
(defcustom org-CUA-compatible nil
  "Non-nil means use alternative key bindings for S-<cursor movement>.
Org-mode used S-<cursor movement> for changing timestamps and priorities.
S-<cursor movement> is also used for example by `CUA-mode' to select text.
If you want to use Org-mode together with `CUA-mode', Org-mode needs to use
alternative bindings.  Setting this variable to t will replace the following
keys both in Org-mode and in the Org-agenda buffer.

S-RET   -> C-S-RET
S-up    -> M-p
S-down  -> M-n
S-left  -> M--
S-right -> M-+

If you do not like the alternative keys, take a look at the variable
`org-disputed-keys'.

This option is only relevant at load-time of Org-mode.  Changing it requires
a restart of Emacs to become effective."
  :group 'org-startup
  :type 'boolean)

(defvar org-disputed-keys
  '((S-up     [(shift up)]      [(meta ?p)])
    (S-down   [(shift down)]    [(meta ?n)])
    (S-left   [(shift left)]    [(meta ?-)])
    (S-right  [(shift right)]   [(meta ?+)])
    (S-return [(shift return)]  [(control shift return)]))
  "Keys for which Org-mode and other modes compete.
This is an alist, cars are symbols for lookup, 1st element is the default key,
second element will be used when `org-CUA-compatible' is t.")

(defun org-key (key)
  "Select a key according to `org-CUA-compatible'."
  (nth (if org-CUA-compatible 2 1)
       (or (assq key org-disputed-keys)
210
	   (error "Invalid Key %s in `org-key'" key))))
211

Richard M. Stallman's avatar
Richard M. Stallman committed
212
(defcustom org-startup-folded t
213 214 215 216 217 218
  "Non-nil means, entering Org-mode will switch to OVERVIEW.
This can also be configured on a per-file basis by adding one of
the following lines anywhere in the buffer:

   #+STARTUP: fold
   #+STARTUP: nofold
219
   #+STARTUP: content"
Richard M. Stallman's avatar
Richard M. Stallman committed
220
  :group 'org-startup
221
  :type '(choice
222 223 224
	  (const :tag "nofold: show all" nil)
	  (const :tag "fold: overview" t)
	  (const :tag "content: all headlines" content)))
Richard M. Stallman's avatar
Richard M. Stallman committed
225 226 227 228 229 230 231 232 233 234 235

(defcustom org-startup-truncated t
  "Non-nil means, entering Org-mode will set `truncate-lines'.
This is useful since some lines containing links can be very long and
uninteresting.  Also tables look terrible when wrapped."
  :group 'org-startup
  :type 'boolean)

(defcustom org-startup-with-deadline-check nil
  "Non-nil means, entering Org-mode will run the deadline check.
This means, if you start editing an org file, you will get an
236 237 238 239 240
immediate reminder of any due deadlines.
This can also be configured on a per-file basis by adding one of
the following lines anywhere in the buffer:

   #+STARTUP: dlcheck
241
   #+STARTUP: nodlcheck"
Richard M. Stallman's avatar
Richard M. Stallman committed
242 243 244
  :group 'org-startup
  :type 'boolean)

245
(defcustom org-insert-mode-line-in-empty-file nil
Richard M. Stallman's avatar
Richard M. Stallman committed
246
  "Non-nil means insert the first line setting Org-mode in empty files.
247
When the function `org-mode' is called interactively in an empty file, this
Richard M. Stallman's avatar
Richard M. Stallman committed
248 249
normally means that the file name does not automatically trigger Org-mode.
To ensure that the file will always be in Org-mode in the future, a
250 251
line enforcing Org-mode will be inserted into the buffer, if this option
has been set."
Richard M. Stallman's avatar
Richard M. Stallman committed
252 253 254 255 256 257 258 259 260
  :group 'org-startup
  :type 'boolean)

(defgroup org-keywords nil
  "Options concerning TODO items in Org-mode."
  :tag "Org Keywords"
  :group 'org)

(defcustom org-todo-keywords '("TODO" "DONE")
261 262
  "List of TODO entry keywords.
\\<org-mode-map>By default, this is '(\"TODO\" \"DONE\").  The last entry in the list is
Richard M. Stallman's avatar
Richard M. Stallman committed
263 264 265 266 267 268 269 270 271 272 273
considered to mean that the entry is \"done\".  All the other mean that
action is required, and will make the entry show up in todo lists, diaries
etc.
The command \\[org-todo] cycles an entry through these states, and an
additional state where no keyword is present.  For details about this
cycling, see also the variable `org-todo-interpretation'
Changes become only effective after restarting Emacs."
  :group 'org-keywords
  :type '(repeat (string :tag "Keyword")))

(defcustom org-todo-interpretation 'sequence
274 275
  "Controls how TODO keywords are interpreted.
\\<org-mode-map>Possible values are `sequence' and `type'.
Richard M. Stallman's avatar
Richard M. Stallman committed
276 277 278 279 280
This variable is only relevant if `org-todo-keywords' contains more than two
states.  There are two ways how these keywords can be used:

- As a sequence in the process of working on a TODO item, for example
  (setq org-todo-keywords '(\"TODO\" \"STARTED\" \"VERIFY\" \"DONE\")
281
	org-todo-interpretation 'sequence)
Richard M. Stallman's avatar
Richard M. Stallman committed
282 283 284

- As different types of TODO items, for example
  (setq org-todo-keywords '(\"URGENT\" \"RELAXED\" \"REMIND\" \"FOR_TOM\" \"DONE\")
285
	org-todo-interpretation 'type)
Richard M. Stallman's avatar
Richard M. Stallman committed
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301

When the states are interpreted as a sequence, \\[org-todo] always cycles
to the next state, in order to walk through all different states.  So with
\\[org-todo], you turn an empty entry into the state TODO.  When you started
working on the item, you use \\[org-todo] again to switch it to \"STARTED\",
later to VERIFY and finally to DONE.

When the states are interpreted as types, \\[org-todo] still cycles through
when it is called several times in direct succession, in order to initially
select the type.  However, if not called immediately after a previous
\\[org-todo], it switches from each type directly to DONE.  So with the
above example, you could use `\\[org-todo] \\[org-todo]' to label an entry
RELAXED.  If you later return to this entry and press \\[org-todo] again,
RELAXED will not be changed REMIND, but directly to DONE.

You can create a large number of types.  To initially select a
302
type, it is then best to use \\[universal-argument] \\[org-todo] in order to specify the
Richard M. Stallman's avatar
Richard M. Stallman committed
303 304 305 306 307
type with completion.  Of course, you can also type the keyword
directly into the buffer.  M-TAB completes TODO keywords at the
beginning of a headline."
  :group 'org-keywords
  :type '(choice (const sequence)
308
		 (const type)))
Richard M. Stallman's avatar
Richard M. Stallman committed
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338

(defcustom org-default-priority ?B
  "The default priority of TODO items.
This is the priority an item get if no explicit priority is given."
  :group 'org-keywords
  :type 'character)

(defcustom org-lowest-priority ?C
  "The lowest priority of TODO items.  A character like ?A, ?B etc."
  :group 'org-keywords
  :type 'character)

(defcustom org-deadline-string "DEADLINE:"
  "String to mark deadline entries.
A deadline is this string, followed by a time stamp.  Should be a word,
terminated by a colon.  You can insert a schedule keyword and
a timestamp with \\[org-deadline].
Changes become only effective after restarting Emacs."
  :group 'org-keywords
  :type 'string)

(defcustom org-scheduled-string "SCHEDULED:"
  "String to mark scheduled TODO entries.
A schedule is this string, followed by a time stamp.  Should be a word,
terminated by a colon.  You can insert a schedule keyword and
a timestamp with \\[org-schedule].
Changes become only effective after restarting Emacs."
  :group 'org-keywords
  :type 'string)

Carsten Dominik's avatar
Carsten Dominik committed
339
(defcustom org-closed-string "CLOSED:"
340
  "String used as the prefix for timestamps logging closing a TODO entry."
Carsten Dominik's avatar
Carsten Dominik committed
341 342 343
  :group 'org-keywords
  :type 'string)

Richard M. Stallman's avatar
Richard M. Stallman committed
344 345 346 347 348 349 350 351
(defcustom org-comment-string "COMMENT"
  "Entries starting with this keyword will never be exported.
An entry can be toggled between COMMENT and normal with
\\[org-toggle-comment].
Changes become only effective after restarting Emacs."
  :group 'org-keywords
  :type 'string)

352 353 354 355 356
(defcustom org-quote-string "QUOTE"
  "Entries starting with this keyword will be exported in fixed-width font.
Quoting applies only to the text in the entry following the headline, and does
not extend beyond the next headline, even if that is lower level.
An entry can be toggled between QUOTE and normal with
357
\\[org-toggle-fixed-width-section]."
358 359 360
  :group 'org-keywords
  :type 'string)

Richard M. Stallman's avatar
Richard M. Stallman committed
361 362
(defcustom org-after-todo-state-change-hook nil
  "Hook which is run after the state of a TODO item was changed.
363
The new state (a string with a TODO keyword, or nil) is available in the
364
Lisp variable `state'."
Richard M. Stallman's avatar
Richard M. Stallman committed
365 366 367 368 369 370 371 372
  :group 'org-keywords
  :type 'hook)

;; Variables for pre-computed regular expressions, all buffer local
(defvar org-todo-kwd-priority-p nil
  "Do TODO items have priorities?")
(make-variable-buffer-local 'org-todo-kwd-priority-p)
(defvar org-todo-kwd-max-priority nil
373
  "Maximum priority of TODO items.")
Richard M. Stallman's avatar
Richard M. Stallman committed
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
(make-variable-buffer-local 'org-todo-kwd-max-priority)
(defvar org-ds-keyword-length 12
  "Maximum length of the Deadline and SCHEDULED keywords.")
(make-variable-buffer-local 'org-ds-keyword-length)
(defvar org-done-string nil
  "The last string in `org-todo-keywords', indicating an item is DONE.")
(make-variable-buffer-local 'org-done-string)
(defvar org-todo-regexp nil
  "Matches any of the TODO state keywords.")
(make-variable-buffer-local 'org-todo-regexp)
(defvar org-not-done-regexp nil
  "Matches any of the TODO state keywords except the last one.")
(make-variable-buffer-local 'org-not-done-regexp)
(defvar org-todo-line-regexp nil
  "Matches a headline and puts TODO state into group 2 if present.")
(make-variable-buffer-local 'org-todo-line-regexp)
390
(defvar org-nl-done-regexp nil
Richard M. Stallman's avatar
Richard M. Stallman committed
391
  "Matches newline followed by a headline with the DONE keyword.")
392
(make-variable-buffer-local 'org-nl-done-regexp)
Richard M. Stallman's avatar
Richard M. Stallman committed
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
(defvar org-looking-at-done-regexp nil
  "Matches the DONE keyword a point.")
(make-variable-buffer-local 'org-looking-at-done-regexp)
(defvar org-deadline-regexp nil
  "Matches the DEADLINE keyword.")
(make-variable-buffer-local 'org-deadline-regexp)
(defvar org-deadline-time-regexp nil
  "Matches the DEADLINE keyword together with a time stamp.")
(make-variable-buffer-local 'org-deadline-time-regexp)
(defvar org-deadline-line-regexp nil
  "Matches the DEADLINE keyword and the rest of the line.")
(make-variable-buffer-local 'org-deadline-line-regexp)
(defvar org-scheduled-regexp nil
  "Matches the SCHEDULED keyword.")
(make-variable-buffer-local 'org-scheduled-regexp)
(defvar org-scheduled-time-regexp nil
  "Matches the SCHEDULED keyword together with a time stamp.")
(make-variable-buffer-local 'org-scheduled-time-regexp)

412 413 414 415 416 417
(defvar org-category nil
  "Variable used by org files to set a category for agenda display.
Such files should use a file variable to set it, for example

   -*- mode: org; org-category: \"ELisp\"

418 419 420 421 422
or contain a special line

#+CATEGORY: ELisp

If the file does not specify a category, then file's base name
423
is used instead.")
Carsten Dominik's avatar
Carsten Dominik committed
424
(make-variable-buffer-local 'org-category)
425

Richard M. Stallman's avatar
Richard M. Stallman committed
426 427 428 429 430
(defgroup org-time nil
  "Options concerning time stamps and deadlines in Org-mode."
  :tag "Org Time"
  :group 'org)

431 432 433 434 435
(defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
  "Formats for `format-time-string' which are used for time stamps.
It is not recommended to change this constant.")


Richard M. Stallman's avatar
Richard M. Stallman committed
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456
(defcustom org-deadline-warning-days 30
  "No. of days before expiration during which a deadline becomes active.
This variable governs the display in the org file."
  :group 'org-time
  :type 'number)

(defcustom org-popup-calendar-for-date-prompt t
  "Non-nil means, pop up a calendar when prompting for a date.
In the calendar, the date can be selected with mouse-1.  However, the
minibuffer will also be active, and you can simply enter the date as well.
When nil, only the minibuffer will be available."
  :group 'org-time
  :type 'number)

(defcustom org-calendar-follow-timestamp-change t
  "Non-nil means, make the calendar window follow timestamp changes.
When a timestamp is modified and the calendar window is visible, it will be
moved to the new date."
  :group 'org-time
  :type 'boolean)

Carsten Dominik's avatar
Carsten Dominik committed
457 458 459 460 461 462 463
(defcustom org-log-done nil
  "When set, insert a (non-active) time stamp when TODO entry is marked DONE.
When the state of an entry is changed from nothing to TODO, remove a previous
closing date."
  :group 'org-time
  :type 'boolean)

Richard M. Stallman's avatar
Richard M. Stallman committed
464 465 466 467 468 469 470
(defgroup org-agenda nil
  "Options concerning agenda display Org-mode."
  :tag "Org Agenda"
  :group 'org)

(defcustom org-agenda-files nil
  "A list of org files for agenda/diary display.
471
Entries are added to this list with \\[org-agenda-file-to-front] and removed with
Richard M. Stallman's avatar
Richard M. Stallman committed
472 473 474 475
\\[org-remove-file].  You can also use customize to edit the list."
  :group 'org-agenda
  :type '(repeat file))

476
(defcustom org-agenda-custom-commands '(("w" todo "WAITING"))
477 478 479 480
  "Custom commands for the agenda.
These commands will be offered on the splash screen displayed by the
agenda dispatcher \\[org-agenda].  Each entry is a list of 3 items:

481 482 483 484 485 486 487 488 489 490 491
key    The key (a single char as a string) to be associated with the command.
type   The command type, any of the following symbols:
        todo        Entries with a specific TODO keyword, in all agenda files.
        tags        Tags match in all agenda files.
        todo-tree   Sparse tree of specific TODO keyword in *current* file.
        tags-tree   Sparse tree with all tags matches in *current* file.
        occur-tree  Occur sparse tree for current file.
match  What to search for:
        - a single keyword for TODO keyword searches
        - a tags match expression for tags searches
        - a regular expression for occur searches"
492 493 494
  :group 'org-agenda
  :type '(repeat
	  (list (string :tag "Key")
495 496 497 498 499 500
		(choice :tag "Type"
			(const :tag "Tags search in all agenda files" tags)
			(const :tag "TODO keyword search in all agenda files" todo)
			(const :tag "Tags sparse tree in current buffer" tags-tree)
			(const :tag "TODO keyword tree in current buffer" todo-tree)
			(const :tag "Occur tree in current buffer" occur-tree))
501 502
		(string :tag "Match"))))

Richard M. Stallman's avatar
Richard M. Stallman committed
503 504 505 506 507 508 509 510
(defcustom org-select-timeline-window t
  "Non-nil means, after creating a timeline, move cursor into Timeline window.
When nil, cursor will remain in the current window."
  :group 'org-agenda
  :type 'boolean)

(defcustom org-select-agenda-window t
  "Non-nil means, after creating an agenda, move cursor into Agenda window.
511
When nil, cursor will remain in the current window."
Richard M. Stallman's avatar
Richard M. Stallman committed
512 513 514
  :group 'org-agenda
  :type 'boolean)

515
(defcustom org-fit-agenda-window t
516
  "Non-nil means, change window size of agenda to fit content."
517 518 519
  :group 'org-agenda
  :type 'boolean)

Richard M. Stallman's avatar
Richard M. Stallman committed
520 521 522 523 524 525 526 527 528 529
(defcustom org-agenda-show-all-dates t
  "Non-nil means, `org-agenda' shows every day in the selected range.
When nil, only the days which actually have entries are shown."
  :group 'org-agenda
  :type 'boolean)

;; FIXME: First day of month works only for current month because it would
;; require a variable ndays treatment.
(defcustom org-agenda-start-on-weekday 1
  "Non-nil means, start the overview always on the specified weekday.
530
0 Denotes Sunday, 1 denotes Monday etc.
Richard M. Stallman's avatar
Richard M. Stallman committed
531 532 533
When nil, always start on the current day."
  :group 'org-agenda
  :type '(choice (const :tag "Today" nil)
534 535
		 (const :tag "First day of month" t)
		 (number :tag "Weekday No.")))
Richard M. Stallman's avatar
Richard M. Stallman committed
536 537 538 539 540 541 542

(defcustom org-agenda-ndays 7
  "Number of days to include in overview display."
  :group 'org-agenda
  :type 'number)

(defcustom org-agenda-include-all-todo t
543
  "Non-nil means, the agenda will always contain all TODO entries.
Richard M. Stallman's avatar
Richard M. Stallman committed
544 545 546
When nil, date-less entries will only be shown if `org-agenda' is called
with a prefix argument.
When non-nil, the TODO entries will be listed at the top of the agenda, before
547
the entries for specific days."
Richard M. Stallman's avatar
Richard M. Stallman committed
548 549 550 551
  :group 'org-agenda
  :type 'boolean)

(defcustom org-agenda-include-diary nil
552
  "If non-nil, include in the agenda entries from the Emacs Calendar's diary."
Richard M. Stallman's avatar
Richard M. Stallman committed
553 554 555
  :group 'org-agenda
  :type 'boolean)

556 557 558
(defcustom org-calendar-to-agenda-key [?c]
  "The key to be installed in `calendar-mode-map' for switching to the agenda.
The command `org-calendar-goto-agenda' will be bound to this key.  The
559 560
default is the character `c' because then `c' can be used to switch back and
forth between agenda and calendar."
561 562
  :group 'org-agenda
  :type 'sexp)
Richard M. Stallman's avatar
Richard M. Stallman committed
563 564 565 566 567

(defcustom org-agenda-sorting-strategy '(time-up category-keep priority-down)
  "Sorting structure for the agenda items of a single day.
This is a list of symbols which will be used in sequence to determine
if an entry should be listed before another entry.  The following
568
symbols are recognized:
Richard M. Stallman's avatar
Richard M. Stallman committed
569 570 571 572

time-up         Put entries with time-of-day indications first, early first
time-down       Put entries with time-of-day indications first, late first
category-keep   Keep the default order of categories, corresponding to the
573
		sequence in `org-agenda-files'.
Richard M. Stallman's avatar
Richard M. Stallman committed
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588
category-up     Sort alphabetically by category, A-Z.
category-down   Sort alphabetically by category, Z-A.
priority-up     Sort numerically by priority, high priority last.
priority-down   Sort numerically by priority, high priority first.

The different possibilities will be tried in sequence, and testing stops
if one comparison returns a \"not-equal\".  For example, the default
    '(time-up category-keep priority-down)
means: Pull out all entries having a specified time of day and sort them,
in order to make a time schedule for the current day the first thing in the
agenda listing for the day.  Of the entries without a time indication, keep
the grouped in categories, don't sort the categories, but keep them in
the sequence given in `org-agenda-files'.  Within each category sort by
priority.

589
Leaving out `category-keep' would mean that items will be sorted across
Richard M. Stallman's avatar
Richard M. Stallman committed
590 591
categories by priority."
  :group 'org-agenda
592
  :type '(repeat
593 594 595 596 597 598 599 600
	  (choice
	   (const time-up)
	   (const time-down)
	   (const category-keep)
	   (const category-up)
	   (const category-down)
	   (const priority-up)
	   (const priority-down))))
Richard M. Stallman's avatar
Richard M. Stallman committed
601

602
(defcustom org-agenda-prefix-format "  %-12:c%?-12t% s"
603 604 605 606 607
  "Format specification for the prefix of items in the agenda buffer.
This format works similar to a printf format, with the following meaning:

  %c   the category of the item, \"Diary\" for entries from the diary, or
       as given by the CATEGORY keyword or derived from the file name.
608
  %T   the first tag of the item.
609 610 611 612
  %t   the time-of-day specification if one applies to the entry, in the
       format HH:MM
  %s   Scheduling/Deadline information, a short string

613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
All specifiers work basically like the standard `%s' of printf, but may
contain two additional characters:  A question mark just after the `%' and
a whitespace/punctuation character just before the final letter.

If the first character after `%' is a question mark, the entire field
will only be included if the corresponding value applies to the
current entry.  This is useful for fields which should have fixed
width when present, but zero width when absent.  For example,
\"%?-12t\" will result in a 12 character time field if a time of the
day is specified, but will completely disappear in entries which do
not contain a time.

If there is punctuation or whitespace character just before the final
format letter, this character will be appended to the field value if
the value is not empty.  For example, the format \"%-12:c\" leads to
\"Diary: \" if the category is \"Diary\".  If the category were be
empty, no additional colon would be interted.

The default value of this option is \"  %-12:c%?-12t% s\", meaning:
- Indent the line with two space characters
- Give the category in a 12 chars wide field, padded with whitespace on
  the right (because of `-').  Append a colon if there is a category
  (because of `:').
- If there is a time-of-day, put it into a 12 chars wide field.  If no
  time, don't put in an empty field, just skip it (because of '?').
- Finally, put the scheduling information and append a whitespace.

As another example, if you don't want the time-of-day of entries in
the prefix, you could use:

  (setq org-agenda-prefix-format \"  %-11:c% s\")

645 646
See also the variables `org-agenda-remove-times-when-in-prefix' and
`org-agenda-remove-tags-when-in-prefix'."
647 648 649 650 651 652 653 654 655
  :type 'string
  :group 'org-agenda)

(defcustom org-timeline-prefix-format "  % s"
  "Like `org-agenda-prefix-format', but for the timeline of a single file."
  :type 'string
  :group 'org-agenda)

(defvar org-prefix-format-compiled nil
656 657 658 659 660 661 662
  "The compiled version of the most recently used prefix format.
Depending on which command was used last, this may be the compiled version
of `org-agenda-prefix-format' or `org-timeline-prefix-format'.")

(defcustom org-agenda-use-time-grid t
  "Non-nil means, show a time grid in the agenda schedule.
A time grid is a set of lines for specific times (like every two hours between
663
8:00 and 20:00).  The items scheduled for a day at specific times are
664
sorted in between these lines.
665
For details about when the grid will be shown, and what it will look like, see
666 667 668 669
the variable `org-agenda-time-grid'."
  :group 'org-agenda
  :type 'boolean)

670
(defcustom org-agenda-time-grid
671 672 673 674
  '((daily today require-timed)
    "----------------"
    (800 1000 1200 1400 1600 1800 2000))

675 676 677 678 679 680 681 682 683 684 685 686 687
  "The settings for time grid for agenda display.
This is a list of three items.  The first item is again a list.  It contains
symbols specifying conditions when the grid should be displayed:

 daily         if the agenda shows a single day
 weekly        if the agenda shows an entire week
 today         show grid on current date, independent of daily/weekly display
 require-timed show grid only if at least on item has a time specification

The second item is a string which will be places behing the grid time.

The third item is a list of integers, indicating the times that should have
a grid line."
688
  :group 'org-agenda
689
  :type
690 691
  '(list
    (set :greedy t :tag "Grid Display Options"
692 693 694 695 696 697 698
	 (const :tag "Show grid in single day agenda display" daily)
	 (const :tag "Show grid in weekly agenda display" weekly)
	 (const :tag "Always show grid for today" today)
	 (const :tag "Show grid only if any timed entries are present"
		require-timed)
	 (const :tag "Skip grid times already present in an entry"
		remove-match))
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714
    (string :tag "Grid String")
    (repeat :tag "Grid Times" (integer :tag "Time"))))

(defcustom org-agenda-remove-times-when-in-prefix t
  "Non-nil means, remove duplicate time specifications in agenda items.
When the format `org-agenda-prefix-format' contains a `%t' specifier, a
time-of-day specification in a headline or diary entry is extracted and
placed into the prefix.  If this option is non-nil, the original specification
\(a timestamp or -range, or just a plain time(range) specification like
11:30-4pm) will be removed for agenda display.  This makes the agenda less
cluttered.
The option can be t or nil.  It may also be the symbol `beg', indicating
that the time should only be removed what it is located at the beginning of
the headline/diary entry."
  :group 'org-agenda
  :type '(choice
715 716 717
	  (const :tag "Always" t)
	  (const :tag "Never" nil)
	  (const :tag "When at beginning of entry" beg)))
718

Richard M. Stallman's avatar
Richard M. Stallman committed
719 720 721 722
(defcustom org-sort-agenda-notime-is-late t
  "Non-nil means, items without time are considered late.
This is only relevant for sorting.  When t, items which have no explicit
time like 15:30 will be considered as 24:01, i.e. later than any items which
723 724 725
do have a time.  When nil, the default time is before 0:00.  You can use this
option to decide if the schedule for today should come before or after timeless
agenda entries."
Richard M. Stallman's avatar
Richard M. Stallman committed
726 727 728
  :group 'org-agenda
  :type 'boolean)

729 730 731 732 733 734 735 736 737 738
(defcustom org-agenda-remove-tags-when-in-prefix nil
  "Non-nil means, the tags from copy of headline in agenda.
When this is the symbol `prefix', only remove tags when
`org-agenda-prefix-format' contains a `%T' specifier."
  :group 'org-agenda
  :type '(choice
	  (const :tag "Always" t)
	  (const :tag "Never" nil)
	  (const :tag "When prefix format contains %T" prefix)))

Richard M. Stallman's avatar
Richard M. Stallman committed
739 740 741 742 743
(defgroup org-structure nil
  "Options concerning structure editing in Org-mode."
  :tag "Org Structure"
  :group 'org)

744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764
(defcustom org-cycle-include-plain-lists nil
  "Non-nil means, include plain lists into visibility cycling.
This means that during cycling, plain list items will *temporarily* be
interpreted as outline headlines with a level given by 1000+i where i is the
indentation of the bullet.  In all other operations, plain list items are
not seen as headlines.  For example, you cannot assign a TODO keyword to
such an item."
  :group 'org-structure
  :type 'boolean)

(defcustom org-cycle-emulate-tab t
  "Where should `org-cycle' emulate TAB.
nil    Never
white  Only in completely white lines
t      Everywhere except in headlines"
  :group 'org-structure
  :type '(choice (const :tag "Never" nil)
		 (const :tag "Only in completely white lines" white)
		 (const :tag "Everywhere except in headlines" t)
		 ))

765 766 767
(defcustom org-cycle-hook '(org-optimize-window-after-visibility-change)
  "Hook that is run after `org-cycle' has changed the buffer visibility.
The function(s) in this hook must accept a single argument which indicates
768
the new state that was set by the most recent `org-cycle' command.  The
769 770 771 772 773 774
argument is a symbol.  After a global state change, it can have the values
`overview', `content', or `all'.  After a local state change, it can have
the values `folded', `children', or `subtree'."
  :group 'org-structure
  :type 'hook)

775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792
(defcustom org-highlight-sparse-tree-matches t
  "Non-nil means, highlight all matches that define a sparse tree.
The highlights will automatically disappear the next time the buffer is
changed by an edit command."
  :group 'org-structure
  :type 'boolean)

(defcustom org-show-hierarchy-above t
  "Non-nil means, show full hierarchy when showing a spot in the tree.
Turning this off makes sparse trees more compact, but also less clear."
  :group 'org-structure
  :type 'boolean)

(defcustom org-show-following-heading t
  "Non-nil means, show heading following match in `org-occur'.
When doing an `org-occur' it is useful to show the headline which
follows the match, even if they do not match the regexp.  This makes it
easier to edit directly inside the sparse tree.  However, if you use
793
`org-occur' mainly as an overview, the following headlines are
794 795 796 797
unnecessary clutter."
  :group 'org-structure
  :type 'boolean)

798 799 800 801 802 803 804
(defcustom org-occur-hook '(org-first-headline-recenter)
  "Hook that is run after `org-occur' has constructed a sparse tree.
This can be used to recenter the window to show as much of the structure
as possible."
  :group 'org-structure
  :type 'hook)

805 806 807 808
(defcustom org-odd-levels-only nil
  "Non-nil means, skip even levels and only use odd levels for the outline.
This has the effect that two stars are being added/taken away in
promotion/demotion commands.  It also influences how levels are
809 810
handled by the exporters.
Changing it requires restart of `font-lock-mode' to become effective
811
for fontification also in regions already fontified." 
812
  :group 'org-structure
813
  :group 'org-font-lock
814 815
  :type 'boolean)

Richard M. Stallman's avatar
Richard M. Stallman committed
816 817 818 819 820 821 822 823 824
(defcustom org-adapt-indentation t
  "Non-nil means, adapt indentation when promoting and demoting.
When this is set and the *entire* text in an entry is indented, the
indentation is increased by one space in a demotion command, and
decreased by one in a promotion command.  If any line in the entry
body starts at column 0, indentation is not changed at all."
  :group 'org-structure
  :type 'boolean)

825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843
(defcustom org-plain-list-ordered-item-terminator t
  "The character that makes a line with leading number an ordered list item.
Valid values are ?. and ?\).  To get both terminators, use t.  While
?. may look nicer, it creates the danger that a line with leading
number may be incorrectly interpreted as an item.  ?\) therefore is
the safe choice."
  :group 'org-structure
  :type '(choice (const :tag "dot like in \"2.\"" ?.)
		 (const :tag "paren like in \"2)\"" ?\))
		 (const :tab "both" t)))

(defcustom org-auto-renumber-ordered-lists t
  "Non-nil means, automatically renumber ordered plain lists.
Renumbering happens when the sequence have been changed with
\\[org-shiftmetaup] or \\[org-shiftmetadown].  After other editing commands,
use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
  :group 'org-structure
  :type 'boolean)

844 845 846 847 848 849 850 851
(defcustom org-enable-fixed-width-editor t
  "Non-nil means, lines starting with \":\" are treated as fixed-width.
This currently only means, they are never auto-wrapped.
When nil, such lines will be treated like ordinary lines.
See also the QUOTE keyword."
  :group 'org-structure
  :type 'boolean)

852 853
(defcustom org-archive-location "%s_archive::"
  "The location where subtrees should be archived.
854
This string consists of two parts, separated by a double-colon.
855 856

The first part is a file name - when omitted, archiving happens in the same
857
file.  %s will be replaced by the current file name (without directory part).
858 859 860 861 862 863 864 865 866
Archiving to a different file is useful to keep archived entries from
contributing to the Org-mode Agenda.

The part after the double colon is a headline.  The archived entries will be
filed under that headline.  When omitted, the subtrees are simply filed away
at the end of the file, as top-level entries.

Here are a few examples:
\"%s_archive::\"
867 868
	If the current file is Projects.org, archive in file
	Projects.org_archive, as top-level trees.  This is the default.
869 870

\"::* Archived Tasks\"
871 872
	Archive in the current file, under the top-level headline
	\"* Archived Tasks\".
873 874

\"~/org/archive.org::\"
875
	Archive in file ~/org/archive.org (absolute path), as top-level trees.
876 877

\"basement::** Finished Tasks\"
878 879
	Archive in file ./basement (relative path), as level 3 trees
	below the level 2 heading \"** Finished Tasks\".
880 881 882

You may set this option on a per-file basis by adding to the buffer a
line like
883

884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899
#+ARCHIVE: basement::** Finished Tasks"
  :group 'org-structure
  :type 'string)

(defcustom org-archive-mark-done t
  "Non-nil means, mark archived entries as DONE."
  :group 'org-structure
  :type 'boolean)

(defcustom org-archive-stamp-time t
  "Non-nil means, add a time stamp to archived entries.
The time stamp will be added directly after the TODO state keyword in the
first line, so it is probably best to use this in combinations with
`org-archive-mark-done'."
  :group 'org-structure
  :type 'boolean)
900

901 902 903 904 905
(defgroup org-tags nil
  "Options concerning startup of Org-mode."
  :tag "Org Tags"
  :group 'org)

906
(defcustom org-tags-column 48
907
  "The column to which tags should be indented in a headline.
908
If this number is positive, it specifies the column.  If it is negative,
909 910 911 912 913
it means that the tags should be flushright to that column.  For example,
-79 works well for a normal 80 character screen."
  :group 'org-tags
  :type 'integer)

914 915 916 917 918 919 920 921
(defcustom org-auto-align-tags t
  "Non-nil means, realign tags after pro/demotion of TODO state change.
These operations change the length of a headline and therefore shift
the tags around.  With this options turned on, after each such operation
the tags are again aligned to `org-tags-column'."
  :group 'org-tags
  :type 'boolean)

922 923
(defcustom org-use-tag-inheritance t
  "Non-nil means, tags in levels apply also for sublevels.
924
When nil, only the tags directly given in a specific line apply there.
925 926
If you turn off this option, you very likely want to turn on the
companion option `org-tags-match-list-sublevels'."
927 928 929 930 931 932 933 934
  :group 'org-tags
  :type 'boolean)

(defcustom org-tags-match-list-sublevels nil
  "Non-nil means list also sublevels of headlines matching tag search.
Because of tag inheritance (see variable `org-use-tag-inheritance'),
the sublevels of a headline matching a tag search often also match
the same search.  Listing all of them can create very long lists.
935 936
Setting this variable to nil causes subtrees to be skipped.
This option is off by default, because inheritance in on.  If you turn
937 938 939 940 941
inheritance off, you very likely want to turn this option on.

As a special case, if the tag search is restricted to TODO items, the
value of this variable is ignored and sublevels are always checked, to
make sure all corresponding TODO items find their way into the list."
942 943 944 945 946 947 948 949
  :group 'org-tags
  :type 'boolean)

(defvar org-tags-history nil
  "History of minibuffer reads for tags.")
(defvar org-last-tags-completion-table nil
  "The last used completion table for tags.")

Richard M. Stallman's avatar
Richard M. Stallman committed
950 951 952 953 954
(defgroup org-link nil
  "Options concerning links in Org-mode."
  :tag "Org Link"
  :group 'org)

955 956 957 958 959 960 961 962 963 964 965 966
(defcustom org-tab-follows-link nil
  "Non-nil means, on links TAB will follow the link.
Needs to be set before org.el is loaded."
  :group 'org-link
  :type 'boolean)

(defcustom org-return-follows-link nil
  "Non-nil means, on links RET will follow the link.
Needs to be set before org.el is loaded."
  :group 'org-link
  :type 'boolean)

967 968 969 970 971 972
(defcustom org-mark-ring-length 4
  "Number of different positions to be recorded in the ring
Changing this requires a restart of Emacs to work correctly."
  :group 'org-link
  :type 'interger)

973 974 975 976 977 978 979 980
(defcustom org-link-format "<%s>"
  "Default format for linkes in the buffer.
This is a format string for printf, %s will be replaced by the link text.
If you want to make sure that your link is always properly terminated,
include angle brackets into this format, like \"<%s>\".  Some people also
recommend an additional URL: prefix, so the format would be \"<URL:%s>\"."
  :group 'org-link
  :type '(choice
981 982 983 984
	  (const :tag "\"%s\"   (e.g. http://www.there.com)" "%s")
	  (const :tag "\"<%s>\"  (e.g. <http://www.there.com>)" "<%s>")
	  (const :tag "\"<URL:%s>\"  (e.g. <URL:http://www.there.com>)" "<URL:%s>")
	  (string :tag "Other" :value "<%s>")))
985

Richard M. Stallman's avatar
Richard M. Stallman committed
986 987
(defcustom org-allow-space-in-links t
  "Non-nil means, file names in links may contain space characters.
988 989 990
When nil, it becomes possible to put several links into a line.
Note that in tables, a link never extends accross fields, so in a table
it is always possible to put several links into a line.
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005
Changing this variable requires a restart of Emacs of become effective."
  :group 'org-link
  :type 'boolean)

(defcustom org-radio-targets t
  "Non-nil means activate text matching a link target.
Radio targets are strings in triple angular brackets, like <<<My Target>>>.
When this option is set, any occurrence of \"my target\" in normal text
becomes a link."
  :group 'org-link
  :type 'boolean)

(defcustom org-activate-camels nil
  "Non-nil means, treat words in CamelCase as in-file links.
Changing this requires restart of Emacs to become effective."
Richard M. Stallman's avatar
Richard M. Stallman committed
1006 1007 1008
  :group 'org-link
  :type 'boolean)

1009 1010
(defcustom org-context-in-file-links t
  "Non-nil means, file links from `org-store-link' contain context.
1011
A search string will be added to the file name with :: as separator and
1012 1013
used to find the context when the link is activated by the command
`org-open-at-point'.
Richard M. Stallman's avatar
Richard M. Stallman committed
1014 1015 1016 1017 1018
Using a prefix arg to the command \\[org-store-link] (`org-store-link')
negates this setting for the duration of the command."
  :group 'org-link
  :type 'boolean)

1019 1020 1021 1022 1023 1024
(defcustom org-file-link-context-use-camel-case nil
  "Non-nil means, use CamelCase to store a search context in a file link.
When nil, the search string simply consists of the words of the string."
  :group 'org-link
  :type 'boolean)

Richard M. Stallman's avatar
Richard M. Stallman committed
1025 1026 1027 1028
(defcustom org-keep-stored-link-after-insertion nil
  "Non-nil means, keep link in list for entire session.

The command `org-store-link' adds a link pointing to the current
1029
location to an internal list.  These links accumulate during a session.
Richard M. Stallman's avatar
Richard M. Stallman committed
1030 1031
The command `org-insert-link' can be used to insert links into any
Org-mode file (offering completion for all stored links).  When this
1032
option is nil, every link which has been inserted once using \\[org-insert-link]
Richard M. Stallman's avatar
Richard M. Stallman committed
1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046
will be removed from the list, to make completing the unused links
more efficient."
  :group 'org-link
  :type 'boolean)

(defcustom org-link-frame-setup
  '((vm . vm-visit-folder-other-frame)
    (gnus . gnus-other-frame)
    (file . find-file-other-window))
  "Setup the frame configuration for following links.
When following a link with Emacs, it may often be useful to display
this link in another window or frame.  This variable can be used to
set this up for the different types of links.
For VM, use any of
1047 1048
    `vm-visit-folder'
    `vm-visit-folder-other-frame'
Richard M. Stallman's avatar
Richard M. Stallman committed
1049
For Gnus, use any of
1050 1051
    `gnus'
    `gnus-other-frame'
Richard M. Stallman's avatar
Richard M. Stallman committed
1052
For FILE, use any of
1053 1054 1055
    `find-file'
    `find-file-other-window'
    `find-file-other-frame'
Richard M. Stallman's avatar
Richard M. Stallman committed
1056 1057 1058 1059 1060
For the calendar, use the variable `calendar-setup'.
For BBDB, it is currently only possible to display the matches in
another window."
  :group 'org-link
  :type '(list
1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074
	  (cons (const vm)
		(choice
		 (const vm-visit-folder)
		 (const vm-visit-folder-other-window)
		 (const vm-visit-folder-other-frame)))
	  (cons (const gnus)
		(choice
		 (const gnus)
		 (const gnus-other-frame)))
	  (cons (const file)
		(choice
		 (const find-file)
		 (const find-file-other-window)
		 (const find-file-other-frame)))))
Richard M. Stallman's avatar
Richard M. Stallman committed
1075 1076

(defcustom org-usenet-links-prefer-google nil
1077
  "Non-nil means, `org-store-link' will create web links to Google groups.
Richard M. Stallman's avatar
Richard M. Stallman committed
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095
When nil, Gnus will be used for such links.
Using a prefix arg to the command \\[org-store-link] (`org-store-link')
negates this setting for the duration of the command."
  :group 'org-link
  :type 'boolean)

(defcustom org-open-non-existing-files nil
  "Non-nil means, `org-open-file' will open non-existing file.
When nil, an error will be generated."
  :group 'org-link
  :type 'boolean)

(defcustom org-confirm-shell-links t
  "Non-nil means, ask for confirmation before executing shell links.
The default is true, to keep new users from shooting into their own foot."
  :group 'org-link
  :type 'boolean)

1096
(defconst org-file-apps-defaults-gnu
1097
  '((t . mailcap))
1098
  "Default file applications on a UNIX or GNU/Linux system.
Richard M. Stallman's avatar
Richard M. Stallman committed
1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134
See `org-file-apps'.")

(defconst org-file-apps-defaults-macosx
  '((t        . "open %s")
    ("ps"     . "gv %s")
    ("ps.gz"  . "gv %s")
    ("eps"    . "gv %s")
    ("eps.gz" . "gv %s")
    ("dvi"    . "xdvi %s")
    ("fig"    . "xfig %s"))
  "Default file applications on a MacOS X system.
The system \"open\" is known as a default, but we use X11 applications
for some files for which the OS does not have a good default.
See `org-file-apps'.")

(defconst org-file-apps-defaults-windowsnt
  '((t        . (w32-shell-execute "open" file)))
  "Default file applications on a Windows NT system.
The system \"open\" is used for most files.
See `org-file-apps'.")

(defcustom org-file-apps
  '(
    ("txt" . emacs)
    ("tex" . emacs)
    ("ltx" . emacs)
    ("org" . emacs)
    ("el"  . emacs)
    )
  "External applications for opening `file:path' items in a document.
Org-mode uses system defaults for different file types, but
you can use this variable to set the application for a given file
extension.  The entries in this list are cons cells with a file extension
and the corresponding command.  Possible values for the command are:
 `emacs'     The file will be visited by the current Emacs process.
 `default'   Use the default application for this file type.
1135
 string      A command to be executed by a shell; %s will be replaced
1136
	     by the path to the file.
1137
 sexp        A Lisp form which will be evaluated.  The file path will
1138
	     be available in the Lisp variable `file'.
Richard M. Stallman's avatar
Richard M. Stallman committed
1139 1140 1141
For more examples, see the system specific constants
`org-file-apps-defaults-macosx'
`org-file-apps-defaults-windowsnt'
1142
`org-file-apps-defaults-gnu'."
Richard M. Stallman's avatar
Richard M. Stallman committed
1143 1144
  :group 'org-link
  :type '(repeat
1145 1146 1147 1148
	  (cons (choice :value ""
			(string :tag "Extension")
			(const :tag "Default for unrecognized files" t)
			(const :tag "Links to a directory" directory))
1149
		(choice :value ""
1150 1151 1152 1153
			(const :tag "Visit with Emacs" emacs)
			(const :tag "Use system default" default)
			(string :tag "Command")
			(sexp :tag "Lisp form")))))
Richard M. Stallman's avatar
Richard M. Stallman committed
1154

1155 1156 1157 1158 1159 1160 1161 1162
(defcustom org-mhe-search-all-folders nil
  "Non-nil means, that the search for the mh-message will be extended to 
all folders if the message cannot be found in the folder given in the link.
Searching all folders is very effective with one of the search engines 
supported by MH-E, but will be slow with pick."
  :group 'org-link
  :type 'boolean)

Richard M. Stallman's avatar
Richard M. Stallman committed
1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180
(defgroup org-remember nil
  "Options concerning interaction with remember.el."
  :tag "Org Remember"
  :group 'org)

(defcustom org-directory "~/org"
  "Directory with org files.
This directory will be used as default to prompt for org files.
Used by the hooks for remember.el."
  :group 'org-remember
  :type 'directory)

(defcustom org-default-notes-file "~/.notes"
  "Default target for storing notes.
Used by the hooks for remember.el.  This can be a string, or nil to mean
the value of `remember-data-file'."
  :group 'org-remember
  :type '(choice
1181 1182
	  (const :tag "Default from remember-data-file" nil)
	  file))
Richard M. Stallman's avatar
Richard M. Stallman committed
1183 1184 1185 1186 1187 1188

(defcustom org-reverse-note-order nil
  "Non-nil means, store new notes at the beginning of a file or entry.
When nil, new notes will be filed to the end of a file or entry."
  :group 'org-remember
  :type '(choice
1189 1190 1191 1192
	  (const :tag "Reverse always" t)
	  (const :tag "Reverse never" nil)
	  (repeat :tag "By file name regexp"
		  (cons regexp boolean))))
Richard M. Stallman's avatar
Richard M. Stallman committed
1193 1194 1195 1196 1197 1198

(defgroup org-table nil
  "Options concerning tables in Org-mode."
  :tag "Org Table"
  :group 'org)

1199
(defcustom org-enable-table-editor 'optimized
Richard M. Stallman's avatar
Richard M. Stallman committed
1200
  "Non-nil means, lines starting with \"|\" are handled by the table editor.
1201 1202 1203
When nil, such lines will be treated like ordinary lines.

When equal to the symbol `optimized', the table editor will be optimized to
1204
do the following:
1205
- Use automatic overwrite mode in front of whitespace in table fields.
1206
  This make the structure of the table stay in tact as long as the edited
1207 1208 1209
  field does not exceed the column width.
- Minimize the number of realigns.  Normally, the table is aligned each time
  TAB or RET are pressed to move to another field.  With optimization this
1210
  happens only if changes to a field might have changed the column width.
1211 1212
Optimization requires replacing the functions `self-insert-command',
`delete-char', and `backward-delete-char' in Org-mode buffers, with a
1213
slight (in fact: unnoticeable) speed impact for normal typing.  Org-mode is
1214
very good at guessing when a re-align will be necessary, but you can always
1215
force one with \\[org-ctrl-c-ctrl-c].
1216

1217 1218
If you would like to use the optimized version in Org-mode, but the
un-optimized version in OrgTbl-mode, see the variable `orgtbl-optimized'.
1219 1220

This variable can be used to turn on and off the table editor during a session,
1221 1222 1223
but in order to toggle optimization, a restart is required.

See also the variable `org-table-auto-blank-field'."
Richard M. Stallman's avatar
Richard M. Stallman committed
1224
  :group 'org-table
1225
  :type '(choice
1226 1227 1228
	  (const :tag "off" nil)
	  (const :tag "on" t)
	  (const :tag "on, optimized" optimized)))
Richard M. Stallman's avatar
Richard M. Stallman committed
1229

1230
;; FIXME: We could have a third option which makes it jump only over the first
1231 1232 1233 1234 1235 1236 1237 1238 1239 1240
;; hline in a table.
(defcustom org-table-tab-jumps-over-hlines t
  "Non-nil means, tab in the last column of a table with jump over a hline.
If a horizontal separator line is following the current line,
`org-table-next-field' can either create a new row before that line, or jump
over the line.  When this option is nil, a new line will be created before
this line."
  :group 'org-table
  :type 'boolean)

1241 1242 1243 1244 1245 1246 1247 1248
(defcustom org-table-auto-blank-field t
  "Non-nil means, automatically blank table field when starting to type into it.
This only happens when typing immediately after a field motion
command (TAB, S-TAB or RET).
Only relevant when `org-enable-table-editor' is equal to `optimized'."
  :group 'org-table
  :type 'boolean)

Richard M. Stallman's avatar
Richard M. Stallman committed
1249 1250 1251
(defcustom org-table-default-size "5x2"
  "The default size for newly created tables, Columns x Rows."
  :group 'org-table
1252
   :type 'string)
Richard M. Stallman's avatar
Richard M. Stallman committed
1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285

(defcustom org-table-automatic-realign t
  "Non-nil means, automatically re-align table when pressing TAB or RETURN.
When nil, aligning is only done with \\[org-table-align], or after column
removal/insertion."
  :group 'org-table
  :type 'boolean)

(defcustom org-table-spaces-around-separators '(1 . 1)
  "The number of spaces to be placed before and after separators."
  :group 'org-table
  :type '(cons (number :tag "Before \"|\"") (number :tag " After \"|\"")))

(defcustom org-table-spaces-around-invisible-separators '(1 . 2)
  "The number of spaces to be placed before and after separators.
This option applies when the column separators have been made invisible."
  :group 'org-table
  :type '(cons (number :tag "Before \"|\"") (number :tag " After \"|\"")))

(defcustom org-table-number-regexp "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$"
  "Regular expression for recognizing numbers in table columns.
If a table column contains mostly numbers, it will be aligned to the
right.  If not, it will be aligned to the left.

The default value of this option is a regular expression which allows
anything which looks remotely like a number as used in scientific
context.  For example, all of the following will be considered a
number:
    12    12.2    2.4e-08    2x10^12    4.034+-0.02    2.7(10)  >3.5

Other options offered by the customize interface are more restrictive."
  :group 'org-table
  :type '(choice
1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298
	  (const :tag "Positive Integers"
		 "^[0-9]+$")
	  (const :tag "Integers"
		 "^[-+]?[0-9]+$")
	  (const :tag "Floating Point Numbers"
		 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.[0-9]*\\)$")
	  (const :tag "Floating Point Number or Integer"
		 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.?[0-9]*\\)$")
	  (const :tag "Exponential, Floating point, Integer"
		 "^[-+]?[0-9.]+\\([eEdD][-+0-9]+\\)?$")
	  (const :tag "Very General Number-Like"
		 "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$")
	  (string :tag "Regexp:")))
Richard M. Stallman's avatar
Richard M. Stallman committed
1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316

(defcustom org-table-number-fraction 0.5
  "Fraction of numbers in a column required to make the column align right.
In a column all non-white fields are considered.  If at least this
fraction of fields is matched by `org-table-number-fraction',
alignment to the right border applies."
  :group 'org-table
  :type 'number)

(defcustom org-export-highlight-first-table-line t
  "Non-nil means, highlight the first table line.
In HTML export, this means use <th> instead of <td>.
In tables created with table.el, this applies to the first table line.
In Org-mode tables, all lines before the first horizontal separator
line will be formatted with <th> tags."
  :group 'org-table
  :type 'boolean)

1317 1318 1319 1320 1321 1322 1323
(defcustom org-table-tab-recognizes-table.el t
  "Non-nil means, TAB will automatically notice a table.el table.
When it sees such a table, it moves point into it and - if necessary -
calls `table-recognize-table'."
  :group 'org-table
  :type 'boolean)

1324 1325 1326 1327 1328
(defgroup org-table-calculation nil
  "Options concerning tables in Org-mode."
  :tag "Org Table Calculation"
  :group 'org)

1329 1330
(defcustom org-table-copy-increment t
  "Non-nil means, increment when copying current field with \\[org-table-copy-down]."
1331 1332 1333 1334 1335 1336 1337 1338
  :group 'org-table-calculation
  :type 'boolean)

(defcustom org-calc-default-modes
  '(calc-internal-prec 12
    calc-float-format  (float 5)
    calc-angle-mode    deg
    calc-prefer-frac   nil
1339 1340 1341 1342
    calc-symbolic-mode nil
    calc-date-format (YYYY "-" MM "-" DD " " Www (" " HH ":" mm))
    calc-display-working-message t
    )
1343
  "List with Calc mode settings for use in calc-eval for table formulas.
1344
The list must contain alternating symbols (Calc modes variables and values).
1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380
Don't remove any of the default settings, just change the values.  Org-mode
relies on the variables to be present in the list."
  :group 'org-table-calculation
  :type 'plist)

(defcustom org-table-formula-evaluate-inline t
  "Non-nil means, TAB and RET evaluate a formula in current table field.
If the current field starts with an equal sign, it is assumed to be a formula
which should be evaluated as described in the manual and in the documentation
string of the command `org-table-eval-formula'.  This feature requires the
Emacs calc package.
When this variable is nil, formula calculation is only available through
the command \\[org-table-eval-formula]."
  :group 'org-table-calculation
  :type 'boolean)


(defcustom org-table-formula-use-constants t
  "Non-nil means, interpret constants in formulas in tables.
A constant looks like `$c' or `$Grav' and will be replaced before evaluation
by the value given in `org-table-formula-constants', or by a value obtained
from the `constants.el' package."
  :group 'org-table-calculation
  :type 'boolean)

(defcustom org-table-formula-constants nil
  "Alist with constant names and values, for use in table formulas.
The car of each element is a name of a constant, without the `$' before it.
The cdr is the value as a string.  For example, if you'd like to use the
speed of light in a formula, you would configure

  (setq org-table-formula-constants '((\"c\" . \"299792458.\")))

and then use it in an equation like `$1*$c'."
  :group 'org-table-calculation
  :type '(repeat
1381 1382
	  (cons (string :tag "name")
		(string :tag "value"))))
1383 1384 1385 1386 1387 1388 1389

(defcustom org-table-formula-numbers-only nil
  "Non-nil means, calculate only with numbers in table formulas.
Then all input fields will be converted to a number, and the result
must also be a number.  When nil, calc's full potential is available
in table calculations, including symbolics etc."
  :group 'org-table-calculation