1 ;;; org.el --- Outline-based notes management and organizer
2 ;; Carstens outline-mode for keeping track of everything.
3 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
4 ;; Free Software Foundation, Inc.
6 ;; Author: Carsten Dominik <carsten at orgmode dot org>
7 ;; Keywords: outlines, hypermedia, calendar, wp
8 ;; Homepage: http://orgmode.org
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation, either version 3 of the License, or
16 ;; (at your option) any later version.
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
29 ;; Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing
30 ;; project planning with a fast and effective plain-text system.
32 ;; Org-mode develops organizational tasks around NOTES files that contain
33 ;; information about projects as plain text. Org-mode is implemented on
34 ;; top of outline-mode, which makes it possible to keep the content of
35 ;; large files well structured. Visibility cycling and structure editing
36 ;; help to work with the tree. Tables are easily created with a built-in
37 ;; table editor. Org-mode supports ToDo items, deadlines, time stamps,
38 ;; and scheduling. It dynamically compiles entries into an agenda that
39 ;; utilizes and smoothly integrates much of the Emacs calendar and diary.
40 ;; Plain text URL-like links connect to websites, emails, Usenet
41 ;; messages, BBDB entries, and any files related to the projects. For
42 ;; printing and sharing of notes, an Org-mode file can be exported as a
43 ;; structured ASCII file, as HTML, or (todo and agenda items only) as an
44 ;; iCalendar file. It can also serve as a publishing tool for a set of
47 ;; Installation and Activation
48 ;; ---------------------------
49 ;; See the corresponding sections in the manual at
51 ;; http://orgmode.org/org.html#Installation
55 ;; The documentation of Org-mode can be found in the TeXInfo file. The
56 ;; distribution also contains a PDF version of it. At the homepage of
57 ;; Org-mode, you can read the same text online as HTML. There is also an
58 ;; excellent reference card made by Philip Rooke. This card can be found
59 ;; in the etc/ directory of Emacs 22.
61 ;; A list of recent changes can be found at
62 ;; http://orgmode.org/Changes.html
66 (defvar org-inhibit-highlight-removal nil) ; dynamically scoped param
67 (defvar org-table-formula-constants-local nil
68 "Local version of `org-table-formula-constants'.")
69 (make-variable-buffer-local 'org-table-formula-constants-local)
71 ;;;; Require other packages
79 ;; Emacs 22 calendar compatibility: Make sure the new variables are available
80 (when (fboundp 'defvaralias)
81 (unless (boundp 'calendar-view-holidays-initially-flag)
82 (defvaralias 'calendar-view-holidays-initially-flag
83 'view-calendar-holidays-initially))
84 (unless (boundp 'calendar-view-diary-initially-flag)
85 (defvaralias 'calendar-view-diary-initially-flag
86 'view-diary-entries-initially))
87 (unless (boundp 'diary-fancy-buffer)
88 (defvaralias 'diary-fancy-buffer 'fancy-diary-buffer)))
90 (require 'outline) (require 'noutline)
91 ;; Other stuff we need.
93 (unless (fboundp 'time-subtract) (defalias 'time-subtract 'subtract-time))
98 (require 'org-entities)
102 (require 'org-pcomplete)
104 (require 'org-footnote)
106 (declare-function org-inlinetask-at-task-p "org-inlinetask" ())
107 (declare-function org-inlinetask-outline-regexp "org-inlinetask" ())
108 (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ())
119 ;; load languages based on value of `org-babel-load-languages'
120 (defvar org-babel-load-languages)
122 (defun org-babel-do-load-languages (sym value)
123 "Load the languages defined in `org-babel-load-languages'."
124 (set-default sym value)
126 (let ((active (cdr pair)) (lang (symbol-name (car pair))))
129 (require (intern (concat "ob-" lang))))
131 (funcall 'fmakunbound
132 (intern (concat "org-babel-execute:" lang)))
133 (funcall 'fmakunbound
134 (intern (concat "org-babel-expand-body:" lang)))))))
135 org-babel-load-languages))
137 (defcustom org-babel-load-languages '((emacs-lisp . t))
138 "Languages which can be evaluated in Org-mode buffers.
139 This list can be used to load support for any of the languages
140 below, note that each language will depend on a different set of
141 system executables and/or Emacs modes. When a language is
142 \"loaded\", then code blocks in that language can be evaluated
143 with `org-babel-execute-src-block' bound by default to C-c
144 C-c (note the `org-babel-no-eval-on-ctrl-c-ctrl-c' variable can
145 be set to remove code block evaluation from the C-c C-c
146 keybinding. By default only Emacs Lisp (which has no
147 requirements) is loaded."
149 :set 'org-babel-do-load-languages
150 :type '(alist :tag "Babel Languages"
153 (const :tag "Awk" awk)
156 (const :tag "Asymptote" asymptote)
157 (const :tag "Calc" calc)
158 (const :tag "Clojure" clojure)
159 (const :tag "CSS" css)
160 (const :tag "Ditaa" ditaa)
161 (const :tag "Dot" dot)
162 (const :tag "Emacs Lisp" emacs-lisp)
163 (const :tag "Gnuplot" gnuplot)
164 (const :tag "Haskell" haskell)
165 (const :tag "Javascript" js)
166 (const :tag "Latex" latex)
167 (const :tag "Ledger" ledger)
168 (const :tag "Lilypond" lilypond)
169 (const :tag "Maxima" maxima)
170 (const :tag "Matlab" matlab)
171 (const :tag "Mscgen" mscgen)
172 (const :tag "Ocaml" ocaml)
173 (const :tag "Octave" octave)
174 (const :tag "Org" org)
175 (const :tag "Perl" perl)
176 (const :tag "PlantUML" plantuml)
177 (const :tag "Python" python)
178 (const :tag "Ruby" ruby)
179 (const :tag "Sass" sass)
180 (const :tag "Scheme" scheme)
181 (const :tag "Screen" screen)
182 (const :tag "Shell Script" sh)
183 (const :tag "Sql" sql)
184 (const :tag "Sqlite" sqlite))
185 :value-type (boolean :tag "Activate" :value t)))
187 ;;;; Customization variables
188 (defcustom org-clone-delete-id nil
189 "Remove ID property of clones of a subtree.
190 When non-nil, clones of a subtree don't inherit the ID property.
191 Otherwise they inherit the ID property with a new unique
198 (defconst org-version "7.6"
199 "The version number of the file org.el.")
201 (defun org-version (&optional here)
202 "Show the org-mode version in the echo area.
203 With prefix arg HERE, insert it at point."
205 (let* ((origin default-directory)
206 (version org-version)
208 (dir (concat (file-name-directory (locate-library "org")) "../" )))
209 (when (and (file-exists-p (expand-file-name ".git" dir))
210 (executable-find "git"))
214 (when (eql 0 (shell-command "git describe --abbrev=4 HEAD"))
215 (with-current-buffer "*Shell Command Output*"
216 (goto-char (point-min))
217 (setq git-version (buffer-substring (point) (point-at-eol))))
218 (subst-char-in-string ?- ?. git-version t)
219 (when (string-match "\\S-"
220 (shell-command-to-string
221 "git diff-index --name-only HEAD --"))
222 (setq git-version (concat git-version ".dirty")))
223 (setq version (concat version " (" git-version ")"))))
225 (setq version (format "Org-mode version %s" version))
226 (if here (insert version))
229 ;;; Compatibility constants
231 ;;; The custom variables
234 "Outline-based notes management and organizer."
239 (defcustom org-mode-hook nil
240 "Mode hook for Org-mode, run after the mode was turned on."
244 (defcustom org-load-hook nil
245 "Hook that is run after org.el has been loaded."
249 (defvar org-modules) ; defined below
250 (defvar org-modules-loaded nil
251 "Have the modules been loaded already?")
253 (defun org-load-modules-maybe (&optional force)
254 "Load all extensions listed in `org-modules'."
255 (when (or force (not org-modules-loaded))
257 (condition-case nil (require ext)
258 (error (message "Problems while trying to load feature `%s'" ext))))
260 (setq org-modules-loaded t)))
262 (defun org-set-modules (var value)
263 "Set VAR to VALUE and call `org-load-modules-maybe' with the force flag."
265 (when (featurep 'org)
266 (org-load-modules-maybe 'force)))
268 (when (org-bound-and-true-p org-modules)
269 (let ((a (member 'org-infojs org-modules)))
270 (and a (setcar a 'org-jsinfo))))
272 (defcustom org-modules '(org-bbdb org-bibtex org-docview org-gnus org-info org-jsinfo org-irc org-mew org-mhe org-rmail org-vm org-w3m org-wl)
273 "Modules that should always be loaded together with org.el.
274 If a description starts with <C>, the file is not part of Emacs
275 and loading it will require that you have downloaded and properly installed
276 the org-mode distribution.
278 You can also use this system to load external packages (i.e. neither Org
279 core modules, nor modules from the CONTRIB directory). Just add symbols
280 to the end of the list. If the package is called org-xyz.el, then you need
281 to add the symbol `xyz', and the package must have a call to
285 :set 'org-set-modules
288 (const :tag " bbdb: Links to BBDB entries" org-bbdb)
289 (const :tag " bibtex: Links to BibTeX entries" org-bibtex)
290 (const :tag " crypt: Encryption of subtrees" org-crypt)
291 (const :tag " ctags: Access to Emacs tags with links" org-ctags)
292 (const :tag " docview: Links to doc-view buffers" org-docview)
293 (const :tag " gnus: Links to GNUS folders/messages" org-gnus)
294 (const :tag " id: Global IDs for identifying entries" org-id)
295 (const :tag " info: Links to Info nodes" org-info)
296 (const :tag " jsinfo: Set up Sebastian Rose's JavaScript org-info.js" org-jsinfo)
297 (const :tag " habit: Track your consistency with habits" org-habit)
298 (const :tag " inlinetask: Tasks independent of outline hierarchy" org-inlinetask)
299 (const :tag " irc: Links to IRC/ERC chat sessions" org-irc)
300 (const :tag " mac-message: Links to messages in Apple Mail" org-mac-message)
301 (const :tag " mew Links to Mew folders/messages" org-mew)
302 (const :tag " mhe: Links to MHE folders/messages" org-mhe)
303 (const :tag " protocol: Intercept calls from emacsclient" org-protocol)
304 (const :tag " rmail: Links to RMAIL folders/messages" org-rmail)
305 (const :tag " special-blocks: Turn blocks into LaTeX envs and HTML divs" org-special-blocks)
306 (const :tag " vm: Links to VM folders/messages" org-vm)
307 (const :tag " wl: Links to Wanderlust folders/messages" org-wl)
308 (const :tag " w3m: Special cut/paste from w3m to Org-mode." org-w3m)
309 (const :tag " mouse: Additional mouse support" org-mouse)
310 (const :tag " TaskJuggler: Export tasks to a TaskJuggler project" org-taskjuggler)
312 (const :tag "C annotate-file: Annotate a file with org syntax" org-annotate-file)
313 (const :tag "C bookmark: Org-mode links to bookmarks" org-bookmark)
314 (const :tag "C checklist: Extra functions for checklists in repeated tasks" org-checklist)
315 (const :tag "C choose: Use TODO keywords to mark decisions states" org-choose)
316 (const :tag "C collector: Collect properties into tables" org-collector)
317 (const :tag "C depend: TODO dependencies for Org-mode\n\t\t\t(PARTIALLY OBSOLETE, see built-in dependency support))" org-depend)
318 (const :tag "C drill: Flashcards and spaced repetition for Org-mode" org-drill)
319 (const :tag "C elisp-symbol: Org-mode links to emacs-lisp symbols" org-elisp-symbol)
320 (const :tag "C eshell Support for links to working directories in eshell" org-eshell)
321 (const :tag "C eval: Include command output as text" org-eval)
322 (const :tag "C eval-light: Evaluate inbuffer-code on demand" org-eval-light)
323 (const :tag "C expiry: Expiry mechanism for Org-mode entries" org-expiry)
324 (const :tag "C exp-bibtex: Export citations using BibTeX" org-exp-bibtex)
325 (const :tag "C git-link: Provide org links to specific file version" org-git-link)
326 (const :tag "C interactive-query: Interactive modification of tags query\n\t\t\t(PARTIALLY OBSOLETE, see secondary filtering)" org-interactive-query)
328 (const :tag "C invoice: Help manage client invoices in Org-mode" org-invoice)
330 (const :tag "C jira: Add a jira:ticket protocol to Org-mode" org-jira)
331 (const :tag "C learn: SuperMemo's incremental learning algorithm" org-learn)
332 (const :tag "C mairix: Hook mairix search into Org-mode for different MUAs" org-mairix)
333 (const :tag "C notmuch: Provide org links to notmuch searches or messages" org-notmuch)
334 (const :tag "C mac-iCal Imports events from iCal.app to the Emacs diary" org-mac-iCal)
335 (const :tag "C mac-link-grabber Grab links and URLs from various Mac applications" org-mac-link-grabber)
336 (const :tag "C man: Support for links to manpages in Org-mode" org-man)
337 (const :tag "C mtags: Support for muse-like tags" org-mtags)
338 (const :tag "C odt: OpenDocumentText exporter for Org-mode" org-odt)
339 (const :tag "C panel: Simple routines for us with bad memory" org-panel)
340 (const :tag "C registry: A registry for Org-mode links" org-registry)
341 (const :tag "C org2rem: Convert org appointments into reminders" org2rem)
342 (const :tag "C screen: Visit screen sessions through Org-mode links" org-screen)
343 (const :tag "C secretary: Team management with org-mode" org-secretary)
344 (const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert)
345 (const :tag "C toc: Table of contents for Org-mode buffer" org-toc)
346 (const :tag "C track: Keep up with Org-mode development" org-track)
347 (const :tag "C velocity Something like Notational Velocity for Org" org-velocity)
348 (const :tag "C wikinodes: CamelCase wiki-like links" org-wikinodes)
349 (repeat :tag "External packages" :inline t (symbol :tag "Package"))))
351 (defcustom org-support-shift-select nil
352 "Non-nil means make shift-cursor commands select text when possible.
354 In Emacs 23, when `shift-select-mode' is on, shifted cursor keys start
355 selecting a region, or enlarge regions started in this way.
356 In Org-mode, in special contexts, these same keys are used for other
357 purposes, important enough to compete with shift selection. Org tries
358 to balance these needs by supporting `shift-select-mode' outside these
359 special contexts, under control of this variable.
361 The default of this variable is nil, to avoid confusing behavior. Shifted
362 cursor keys will then execute Org commands in the following contexts:
363 - on a headline, changing TODO state (left/right) and priority (up/down)
364 - on a time stamp, changing the time
365 - in a plain list item, changing the bullet type
366 - in a property definition line, switching between allowed values
367 - in the BEGIN line of a clock table (changing the time block).
368 Outside these contexts, the commands will throw an error.
370 When this variable is t and the cursor is not in a special context,
371 Org-mode will support shift-selection for making and enlarging regions.
372 To make this more effective, the bullet cycling will no longer happen
373 anywhere in an item line, but only if the cursor is exactly on the bullet.
375 If you set this variable to the symbol `always', then the keys
376 will not be special in headlines, property lines, and item lines, to make
377 shift selection work there as well. If this is what you want, you can
378 use the following alternative commands: `C-c C-t' and `C-c ,' to
379 change TODO state and priority, `C-u C-u C-c C-t' can be used to switch
380 TODO sets, `C-c -' to cycle item bullet types, and properties can be
381 edited by hand or in column view.
383 However, when the cursor is on a timestamp, shift-cursor commands
384 will still edit the time stamp - this is just too good to give up.
386 XEmacs user should have this variable set to nil, because shift-select-mode
390 (const :tag "Never" nil)
391 (const :tag "When outside special context" t)
392 (const :tag "Everywhere except timestamps" always)))
394 (defgroup org-startup nil
395 "Options concerning startup of Org-mode."
399 (defcustom org-startup-folded t
400 "Non-nil means entering Org-mode will switch to OVERVIEW.
401 This can also be configured on a per-file basis by adding one of
402 the following lines anywhere in the buffer:
404 #+STARTUP: fold (or `overview', this is equivalent)
405 #+STARTUP: nofold (or `showall', this is equivalent)
407 #+STARTUP: showeverything"
410 (const :tag "nofold: show all" nil)
411 (const :tag "fold: overview" t)
412 (const :tag "content: all headlines" content)
413 (const :tag "show everything, even drawers" showeverything)))
415 (defcustom org-startup-truncated t
416 "Non-nil means entering Org-mode will set `truncate-lines'.
417 This is useful since some lines containing links can be very long and
418 uninteresting. Also tables look terrible when wrapped."
422 (defcustom org-startup-indented nil
423 "Non-nil means turn on `org-indent-mode' on startup.
424 This can also be configured on a per-file basis by adding one of
425 the following lines anywhere in the buffer:
429 :group 'org-structure
431 (const :tag "Not" nil)
432 (const :tag "Globally (slow on startup in large files)" t)))
434 (defcustom org-use-sub-superscripts t
435 "Non-nil means interpret \"_\" and \"^\" for export.
436 When this option is turned on, you can use TeX-like syntax for sub- and
437 superscripts. Several characters after \"_\" or \"^\" will be
438 considered as a single item - so grouping with {} is normally not
439 needed. For example, the following things will be parsed as single
440 sub- or superscripts.
442 10^24 or 10^tau several digits will be considered 1 item.
443 10^-12 or 10^-tau a leading sign with digits or a word
444 x^2-y^3 will be read as x^2 - y^3, because items are
445 terminated by almost any nonword/nondigit char.
446 x_{i^2} or x^(2-i) braces or parenthesis do grouping.
448 Still, ambiguity is possible - so when in doubt use {} to enclose the
449 sub/superscript. If you set this variable to the symbol `{}',
450 the braces are *required* in order to trigger interpretations as
451 sub/superscript. This can be helpful in documents that need \"_\"
452 frequently in plain text.
454 Not all export backends support this, but HTML does.
456 This option can also be set with the +OPTIONS line, e.g. \"^:nil\"."
458 :group 'org-export-translation
460 (const :tag "Always interpret" t)
461 (const :tag "Only with braces" {})
462 (const :tag "Never interpret" nil)))
464 (if (fboundp 'defvaralias)
465 (defvaralias 'org-export-with-sub-superscripts 'org-use-sub-superscripts))
468 (defcustom org-startup-with-beamer-mode nil
469 "Non-nil means turn on `org-beamer-mode' on startup.
470 This can also be configured on a per-file basis by adding one of
471 the following lines anywhere in the buffer:
477 (defcustom org-startup-align-all-tables nil
478 "Non-nil means align all tables when visiting a file.
479 This is useful when the column width in tables is forced with <N> cookies
480 in table fields. Such tables will look correct only after the first re-align.
481 This can also be configured on a per-file basis by adding one of
482 the following lines anywhere in the buffer:
488 (defcustom org-startup-with-inline-images nil
489 "Non-nil means show inline images when loading a new Org file.
490 This can also be configured on a per-file basis by adding one of
491 the following lines anywhere in the buffer:
492 #+STARTUP: inlineimages
493 #+STARTUP: noinlineimages"
497 (defcustom org-insert-mode-line-in-empty-file nil
498 "Non-nil means insert the first line setting Org-mode in empty files.
499 When the function `org-mode' is called interactively in an empty file, this
500 normally means that the file name does not automatically trigger Org-mode.
501 To ensure that the file will always be in Org-mode in the future, a
502 line enforcing Org-mode will be inserted into the buffer, if this option
507 (defcustom org-replace-disputed-keys nil
508 "Non-nil means use alternative key bindings for some keys.
509 Org-mode uses S-<cursor> keys for changing timestamps and priorities.
510 These keys are also used by other packages like shift-selection-mode'
511 \(built into Emacs 23), `CUA-mode' or `windmove.el'.
512 If you want to use Org-mode together with one of these other modes,
513 or more generally if you would like to move some Org-mode commands to
514 other keys, set this variable and configure the keys with the variable
517 This option is only relevant at load-time of Org-mode, and must be set
518 *before* org.el is loaded. Changing it requires a restart of Emacs to
523 (defcustom org-use-extra-keys nil
524 "Non-nil means use extra key sequence definitions for certain commands.
525 This happens automatically if you run XEmacs or if `window-system'
526 is nil. This variable lets you do the same manually. You must
527 set it before loading org.
529 Example: on Carbon Emacs 22 running graphically, with an external
530 keyboard on a Powerbook, the default way of setting M-left might
531 not work for either Alt or ESC. Setting this variable will make
536 (if (fboundp 'defvaralias)
537 (defvaralias 'org-CUA-compatible 'org-replace-disputed-keys))
539 (defcustom org-disputed-keys
540 '(([(shift up)] . [(meta p)])
541 ([(shift down)] . [(meta n)])
542 ([(shift left)] . [(meta -)])
543 ([(shift right)] . [(meta +)])
544 ([(control shift right)] . [(meta shift +)])
545 ([(control shift left)] . [(meta shift -)]))
546 "Keys for which Org-mode and other modes compete.
547 This is an alist, cars are the default keys, second element specifies
548 the alternative to use when `org-replace-disputed-keys' is t.
550 Keys can be specified in any syntax supported by `define-key'.
551 The value of this option takes effect only at Org-mode's startup,
552 therefore you'll have to restart Emacs to apply it after changing."
557 "Select key according to `org-replace-disputed-keys' and `org-disputed-keys'.
558 Or return the original if not disputed.
559 Also apply the translations defined in `org-xemacs-key-equivalents'."
560 (when org-replace-disputed-keys
561 (let* ((nkey (key-description key))
562 (x (org-find-if (lambda (x)
563 (equal (key-description (car x)) nkey))
565 (setq key (if x (cdr x) key))))
566 (when (featurep 'xemacs)
567 (setq key (or (cdr (assoc key org-xemacs-key-equivalents)) key)))
570 (defun org-find-if (predicate seq)
573 (if (funcall predicate (car seq))
574 (throw 'exit (car seq))
577 (defun org-defkey (keymap key def)
578 "Define a key, possibly translated, as returned by `org-key'."
579 (define-key keymap (org-key key) def))
581 (defcustom org-ellipsis nil
582 "The ellipsis to use in the Org-mode outline.
583 When nil, just use the standard three dots. When a string, use that instead,
584 When a face, use the standard 3 dots, but with the specified face.
585 The change affects only Org-mode (which will then use its own display table).
586 Changing this requires executing `M-x org-mode' in a buffer to become
589 :type '(choice (const :tag "Default" nil)
590 (face :tag "Face" :value org-warning)
591 (string :tag "String" :value "...#")))
593 (defvar org-display-table nil
594 "The display table for org-mode, in case `org-ellipsis' is non-nil.")
596 (defgroup org-keywords nil
597 "Keywords in Org-mode."
601 (defcustom org-deadline-string "DEADLINE:"
602 "String to mark deadline entries.
603 A deadline is this string, followed by a time stamp. Should be a word,
604 terminated by a colon. You can insert a schedule keyword and
605 a timestamp with \\[org-deadline].
606 Changes become only effective after restarting Emacs."
610 (defcustom org-scheduled-string "SCHEDULED:"
611 "String to mark scheduled TODO entries.
612 A schedule is this string, followed by a time stamp. Should be a word,
613 terminated by a colon. You can insert a schedule keyword and
614 a timestamp with \\[org-schedule].
615 Changes become only effective after restarting Emacs."
619 (defcustom org-closed-string "CLOSED:"
620 "String used as the prefix for timestamps logging closing a TODO entry."
624 (defcustom org-clock-string "CLOCK:"
625 "String used as prefix for timestamps clocking work hours on an item."
629 (defcustom org-comment-string "COMMENT"
630 "Entries starting with this keyword will never be exported.
631 An entry can be toggled between COMMENT and normal with
632 \\[org-toggle-comment].
633 Changes become only effective after restarting Emacs."
637 (defcustom org-quote-string "QUOTE"
638 "Entries starting with this keyword will be exported in fixed-width font.
639 Quoting applies only to the text in the entry following the headline, and does
640 not extend beyond the next headline, even if that is lower level.
641 An entry can be toggled between QUOTE and normal with
642 \\[org-toggle-fixed-width-section]."
646 (defconst org-repeat-re
647 "<[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^>\n]*?\\([.+]?\\+[0-9]+[dwmy]\\(/[0-9]+[dwmy]\\)?\\)"
648 "Regular expression for specifying repeated events.
649 After a match, group 1 contains the repeat expression.")
651 (defgroup org-structure nil
652 "Options concerning the general structure of Org-mode files."
656 (defgroup org-reveal-location nil
657 "Options about how to make context of a location visible."
658 :tag "Org Reveal Location"
659 :group 'org-structure)
661 (defconst org-context-choice
663 (const :tag "Always" t)
664 (const :tag "Never" nil)
665 (repeat :greedy t :tag "Individual contexts"
667 (choice :tag "Context"
674 (const bookmark-jump)
678 "Contexts for the reveal options.")
680 (defcustom org-show-hierarchy-above '((default . t))
681 "Non-nil means show full hierarchy when revealing a location.
682 Org-mode often shows locations in an org-mode file which might have
683 been invisible before. When this is set, the hierarchy of headings
684 above the exposed location is shown.
685 Turning this off for example for sparse trees makes them very compact.
686 Instead of t, this can also be an alist specifying this option for different
687 contexts. Valid contexts are
688 agenda when exposing an entry from the agenda
689 org-goto when using the command `org-goto' on key C-c C-j
690 occur-tree when using the command `org-occur' on key C-c /
691 tags-tree when constructing a sparse tree based on tags matches
692 link-search when exposing search matches associated with a link
693 mark-goto when exposing the jump goal of a mark
694 bookmark-jump when exposing a bookmark location
695 isearch when exiting from an incremental search
696 default default for all contexts not set explicitly"
697 :group 'org-reveal-location
698 :type org-context-choice)
700 (defcustom org-show-following-heading '((default . nil))
701 "Non-nil means show following heading when revealing a location.
702 Org-mode often shows locations in an org-mode file which might have
703 been invisible before. When this is set, the heading following the
705 Turning this off for example for sparse trees makes them very compact,
706 but makes it harder to edit the location of the match. In such a case,
707 use the command \\[org-reveal] to show more context.
708 Instead of t, this can also be an alist specifying this option for different
709 contexts. See `org-show-hierarchy-above' for valid contexts."
710 :group 'org-reveal-location
711 :type org-context-choice)
713 (defcustom org-show-siblings '((default . nil) (isearch t))
714 "Non-nil means show all sibling heading when revealing a location.
715 Org-mode often shows locations in an org-mode file which might have
716 been invisible before. When this is set, the sibling of the current entry
717 heading are all made visible. If `org-show-hierarchy-above' is t,
718 the same happens on each level of the hierarchy above the current entry.
720 By default this is on for the isearch context, off for all other contexts.
721 Turning this off for example for sparse trees makes them very compact,
722 but makes it harder to edit the location of the match. In such a case,
723 use the command \\[org-reveal] to show more context.
724 Instead of t, this can also be an alist specifying this option for different
725 contexts. See `org-show-hierarchy-above' for valid contexts."
726 :group 'org-reveal-location
727 :type org-context-choice)
729 (defcustom org-show-entry-below '((default . nil))
730 "Non-nil means show the entry below a headline when revealing a location.
731 Org-mode often shows locations in an org-mode file which might have
732 been invisible before. When this is set, the text below the headline that is
733 exposed is also shown.
735 By default this is off for all contexts.
736 Instead of t, this can also be an alist specifying this option for different
737 contexts. See `org-show-hierarchy-above' for valid contexts."
738 :group 'org-reveal-location
739 :type org-context-choice)
741 (defcustom org-indirect-buffer-display 'other-window
742 "How should indirect tree buffers be displayed?
743 This applies to indirect buffers created with the commands
744 \\[org-tree-to-indirect-buffer] and \\[org-agenda-tree-to-indirect-buffer].
746 current-window Display in the current window
747 other-window Just display in another window.
748 dedicated-frame Create one new frame, and re-use it each time.
749 new-frame Make a new frame each time. Note that in this case
750 previously-made indirect buffers are kept, and you need to
751 kill these buffers yourself."
752 :group 'org-structure
753 :group 'org-agenda-windows
755 (const :tag "In current window" current-window)
756 (const :tag "In current frame, other window" other-window)
757 (const :tag "Each time a new frame" new-frame)
758 (const :tag "One dedicated frame" dedicated-frame)))
760 (defcustom org-use-speed-commands nil
761 "Non-nil means activate single letter commands at beginning of a headline.
762 This may also be a function to test for appropriate locations where speed
763 commands should be active."
764 :group 'org-structure
766 (const :tag "Never" nil)
767 (const :tag "At beginning of headline stars" t)
770 (defcustom org-speed-commands-user nil
771 "Alist of additional speed commands.
772 This list will be checked before `org-speed-commands-default'
773 when the variable `org-use-speed-commands' is non-nil
774 and when the cursor is at the beginning of a headline.
775 The car if each entry is a string with a single letter, which must
776 be assigned to `self-insert-command' in the global map.
777 The cdr is either a command to be called interactively, a function
778 to be called, or a form to be evaluated.
779 An entry that is just a list with a single string will be interpreted
780 as a descriptive headline that will be added when listing the speed
781 commands in the Help buffer using the `?' speed command."
782 :group 'org-structure
783 :type '(repeat :value ("k" . ignore)
784 (choice :value ("k" . ignore)
785 (list :tag "Descriptive Headline" (string :tag "Headline"))
786 (cons :tag "Letter and Command"
787 (string :tag "Command letter")
792 (defgroup org-cycle nil
793 "Options concerning visibility cycling in Org-mode."
795 :group 'org-structure)
797 (defcustom org-cycle-skip-children-state-if-no-children t
798 "Non-nil means skip CHILDREN state in entries that don't have any."
802 (defcustom org-cycle-max-level nil
803 "Maximum level which should still be subject to visibility cycling.
804 Levels higher than this will, for cycling, be treated as text, not a headline.
805 When `org-odd-levels-only' is set, a value of N in this variable actually
806 means 2N-1 stars as the limiting headline.
807 When nil, cycle all levels.
808 Note that the limiting level of cycling is also influenced by
809 `org-inlinetask-min-level'. When `org-cycle-max-level' is not set but
810 `org-inlinetask-min-level' is, cycling will be limited to levels one less
814 (const :tag "No limit" nil)
815 (integer :tag "Maximum level")))
817 (defcustom org-drawers '("PROPERTIES" "CLOCK" "LOGBOOK")
818 "Names of drawers. Drawers are not opened by cycling on the headline above.
819 Drawers only open with a TAB on the drawer line itself. A drawer looks like
824 The drawer \"PROPERTIES\" is special for capturing properties through
827 Drawers can be defined on the per-file basis with a line like:
829 #+DRAWERS: HIDDEN STATE PROPERTIES"
830 :group 'org-structure
832 :type '(repeat (string :tag "Drawer Name")))
834 (defcustom org-hide-block-startup nil
835 "Non-nil means entering Org-mode will fold all blocks.
836 This can also be set in on a per-file basis with
838 #+STARTUP: hideblocks
839 #+STARTUP: showblocks"
844 (defcustom org-cycle-global-at-bob nil
845 "Cycle globally if cursor is at beginning of buffer and not at a headline.
846 This makes it possible to do global cycling without having to use S-TAB or
847 \\[universal-argument] TAB. For this special case to work, the first line \
849 must not be a headline - it may be empty or some other text. When used in
850 this way, `org-cycle-hook' is disables temporarily, to make sure the
851 cursor stays at the beginning of the buffer.
852 When this option is nil, don't do anything special at the beginning
857 (defcustom org-cycle-level-after-item/entry-creation t
858 "Non-nil means cycle entry level or item indentation in new empty entries.
860 When the cursor is at the end of an empty headline, i.e with only stars
861 and maybe a TODO keyword, TAB will then switch the entry to become a child,
862 and then all possible ancestor states, before returning to the original state.
863 This makes data entry extremely fast: M-RET to create a new headline,
864 on TAB to make it a child, two or more tabs to make it a (grand-)uncle.
866 When the cursor is at the end of an empty plain list item, one TAB will
867 make it a subitem, two or more tabs will back up to make this an item
868 higher up in the item hierarchy."
872 (defcustom org-cycle-emulate-tab t
873 "Where should `org-cycle' emulate TAB.
875 white Only in completely white lines
876 whitestart Only at the beginning of lines, before the first non-white char
877 t Everywhere except in headlines
878 exc-hl-bol Everywhere except at the start of a headline
879 If TAB is used in a place where it does not emulate TAB, the current subtree
880 visibility is cycled."
882 :type '(choice (const :tag "Never" nil)
883 (const :tag "Only in completely white lines" white)
884 (const :tag "Before first char in a line" whitestart)
885 (const :tag "Everywhere except in headlines" t)
886 (const :tag "Everywhere except at bol in headlines" exc-hl-bol)
889 (defcustom org-cycle-separator-lines 2
890 "Number of empty lines needed to keep an empty line between collapsed trees.
891 If you leave an empty line between the end of a subtree and the following
892 headline, this empty line is hidden when the subtree is folded.
893 Org-mode will leave (exactly) one empty line visible if the number of
894 empty lines is equal or larger to the number given in this variable.
895 So the default 2 means at least 2 empty lines after the end of a subtree
896 are needed to produce free space between a collapsed subtree and the
899 If the number is negative, and the number of empty lines is at least -N,
900 all empty lines are shown.
902 Special case: when 0, never leave empty lines in collapsed view."
905 (put 'org-cycle-separator-lines 'safe-local-variable 'integerp)
907 (defcustom org-pre-cycle-hook nil
908 "Hook that is run before visibility cycling is happening.
909 The function(s) in this hook must accept a single argument which indicates
910 the new state that will be set right after running this hook. The
911 argument is a symbol. Before a global state change, it can have the values
912 `overview', `content', or `all'. Before a local state change, it can have
913 the values `folded', `children', or `subtree'."
917 (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees
918 org-cycle-hide-drawers
919 org-cycle-show-empty-lines
920 org-optimize-window-after-visibility-change)
921 "Hook that is run after `org-cycle' has changed the buffer visibility.
922 The function(s) in this hook must accept a single argument which indicates
923 the new state that was set by the most recent `org-cycle' command. The
924 argument is a symbol. After a global state change, it can have the values
925 `overview', `content', or `all'. After a local state change, it can have
926 the values `folded', `children', or `subtree'."
930 (defgroup org-edit-structure nil
931 "Options concerning structure editing in Org-mode."
932 :tag "Org Edit Structure"
933 :group 'org-structure)
935 (defcustom org-odd-levels-only nil
936 "Non-nil means skip even levels and only use odd levels for the outline.
937 This has the effect that two stars are being added/taken away in
938 promotion/demotion commands. It also influences how levels are
939 handled by the exporters.
940 Changing it requires restart of `font-lock-mode' to become effective
941 for fontification also in regions already fontified.
942 You may also set this on a per-file basis by adding one of the following
947 :group 'org-edit-structure
948 :group 'org-appearance
951 (defcustom org-adapt-indentation t
952 "Non-nil means adapt indentation to outline node level.
954 When this variable is set, Org assumes that you write outlines by
955 indenting text in each node to align with the headline (after the stars).
956 The following issues are influenced by this variable:
958 - When this is set and the *entire* text in an entry is indented, the
959 indentation is increased by one space in a demotion command, and
960 decreased by one in a promotion command. If any line in the entry
961 body starts with text at column 0, indentation is not changed at all.
963 - Property drawers and planning information is inserted indented when
964 this variable s set. When nil, they will not be indented.
966 - TAB indents a line relative to context. The lines below a headline
967 will be indented when this variable is set.
969 Note that this is all about true indentation, by adding and removing
970 space characters. See also `org-indent.el' which does level-dependent
971 indentation in a virtual way, i.e. at display time in Emacs."
972 :group 'org-edit-structure
975 (defcustom org-special-ctrl-a/e nil
976 "Non-nil means `C-a' and `C-e' behave specially in headlines and items.
978 When t, `C-a' will bring back the cursor to the beginning of the
979 headline text, i.e. after the stars and after a possible TODO keyword.
980 In an item, this will be the position after the bullet.
981 When the cursor is already at that position, another `C-a' will bring
982 it to the beginning of the line.
984 `C-e' will jump to the end of the headline, ignoring the presence of tags
985 in the headline. A second `C-e' will then jump to the true end of the
986 line, after any tags. This also means that, when this variable is
987 non-nil, `C-e' also will never jump beyond the end of the heading of a
988 folded section, i.e. not after the ellipses.
990 When set to the symbol `reversed', the first `C-a' or `C-e' works normally,
991 going to the true line boundary first. Only a directly following, identical
992 keypress will bring the cursor to the special positions.
994 This may also be a cons cell where the behavior for `C-a' and `C-e' is
996 :group 'org-edit-structure
998 (const :tag "off" nil)
999 (const :tag "on: after stars/bullet and before tags first" t)
1000 (const :tag "reversed: true line boundary first" reversed)
1001 (cons :tag "Set C-a and C-e separately"
1002 (choice :tag "Special C-a"
1003 (const :tag "off" nil)
1004 (const :tag "on: after stars/bullet first" t)
1005 (const :tag "reversed: before stars/bullet first" reversed))
1006 (choice :tag "Special C-e"
1007 (const :tag "off" nil)
1008 (const :tag "on: before tags first" t)
1009 (const :tag "reversed: after tags first" reversed)))))
1010 (if (fboundp 'defvaralias)
1011 (defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e))
1013 (defcustom org-special-ctrl-k nil
1014 "Non-nil means `C-k' will behave specially in headlines.
1015 When nil, `C-k' will call the default `kill-line' command.
1016 When t, the following will happen while the cursor is in the headline:
1018 - When the cursor is at the beginning of a headline, kill the entire
1019 line and possible the folded subtree below the line.
1020 - When in the middle of the headline text, kill the headline up to the tags.
1021 - When after the headline text, kill the tags."
1022 :group 'org-edit-structure
1025 (defcustom org-ctrl-k-protect-subtree nil
1026 "Non-nil means, do not delete a hidden subtree with C-k.
1027 When set to the symbol `error', simply throw an error when C-k is
1028 used to kill (part-of) a headline that has hidden text behind it.
1029 Any other non-nil value will result in a query to the user, if it is
1030 OK to kill that hidden subtree. When nil, kill without remorse."
1031 :group 'org-edit-structure
1033 (const :tag "Do not protect hidden subtrees" nil)
1034 (const :tag "Protect hidden subtrees with a security query" t)
1035 (const :tag "Never kill a hidden subtree with C-k" error)))
1037 (defcustom org-yank-folded-subtrees t
1038 "Non-nil means when yanking subtrees, fold them.
1039 If the kill is a single subtree, or a sequence of subtrees, i.e. if
1040 it starts with a heading and all other headings in it are either children
1041 or siblings, then fold all the subtrees. However, do this only if no
1042 text after the yank would be swallowed into a folded tree by this action."
1043 :group 'org-edit-structure
1046 (defcustom org-yank-adjusted-subtrees nil
1047 "Non-nil means when yanking subtrees, adjust the level.
1048 With this setting, `org-paste-subtree' is used to insert the subtree, see
1049 this function for details."
1050 :group 'org-edit-structure
1053 (defcustom org-M-RET-may-split-line '((default . t))
1054 "Non-nil means M-RET will split the line at the cursor position.
1055 When nil, it will go to the end of the line before making a
1057 You may also set this option in a different way for different
1058 contexts. Valid contexts are:
1060 headline when creating a new headline
1061 item when creating a new item
1062 table in a table field
1063 default the value to be used for all contexts not explicitly
1065 :group 'org-structure
1068 (const :tag "Always" t)
1069 (const :tag "Never" nil)
1070 (repeat :greedy t :tag "Individual contexts"
1072 (choice :tag "Context"
1080 (defcustom org-insert-heading-respect-content nil
1081 "Non-nil means insert new headings after the current subtree.
1082 When nil, the new heading is created directly after the current line.
1083 The commands \\[org-insert-heading-respect-content] and
1084 \\[org-insert-todo-heading-respect-content] turn this variable on
1085 for the duration of the command."
1086 :group 'org-structure
1089 (defcustom org-blank-before-new-entry '((heading . auto)
1090 (plain-list-item . auto))
1091 "Should `org-insert-heading' leave a blank line before new heading/item?
1092 The value is an alist, with `heading' and `plain-list-item' as car,
1093 and a boolean flag as cdr. The cdr may also be the symbol `auto', and then
1094 Org will look at the surrounding headings/items and try to make an
1095 intelligent decision whether to insert a blank line or not.
1097 For plain lists, if the variable `org-empty-line-terminates-plain-lists' is
1098 set, the setting here is ignored and no empty line is inserted, to avoid
1099 breaking the list structure."
1100 :group 'org-edit-structure
1102 (cons (const heading)
1103 (choice (const :tag "Never" nil)
1104 (const :tag "Always" t)
1105 (const :tag "Auto" auto)))
1106 (cons (const plain-list-item)
1107 (choice (const :tag "Never" nil)
1108 (const :tag "Always" t)
1109 (const :tag "Auto" auto)))))
1111 (defcustom org-insert-heading-hook nil
1112 "Hook being run after inserting a new heading."
1113 :group 'org-edit-structure
1116 (defcustom org-enable-fixed-width-editor t
1117 "Non-nil means lines starting with \":\" are treated as fixed-width.
1118 This currently only means they are never auto-wrapped.
1119 When nil, such lines will be treated like ordinary lines.
1120 See also the QUOTE keyword."
1121 :group 'org-edit-structure
1124 (defcustom org-goto-auto-isearch t
1125 "Non-nil means typing characters in `org-goto' starts incremental search."
1126 :group 'org-edit-structure
1129 (defgroup org-sparse-trees nil
1130 "Options concerning sparse trees in Org-mode."
1131 :tag "Org Sparse Trees"
1132 :group 'org-structure)
1134 (defcustom org-highlight-sparse-tree-matches t
1135 "Non-nil means highlight all matches that define a sparse tree.
1136 The highlights will automatically disappear the next time the buffer is
1137 changed by an edit command."
1138 :group 'org-sparse-trees
1141 (defcustom org-remove-highlights-with-change t
1142 "Non-nil means any change to the buffer will remove temporary highlights.
1143 Such highlights are created by `org-occur' and `org-clock-display'.
1144 When nil, `C-c C-c needs to be used to get rid of the highlights.
1145 The highlights created by `org-preview-latex-fragment' always need
1146 `C-c C-c' to be removed."
1147 :group 'org-sparse-trees
1152 (defcustom org-occur-hook '(org-first-headline-recenter)
1153 "Hook that is run after `org-occur' has constructed a sparse tree.
1154 This can be used to recenter the window to show as much of the structure
1156 :group 'org-sparse-trees
1159 (defgroup org-imenu-and-speedbar nil
1160 "Options concerning imenu and speedbar in Org-mode."
1161 :tag "Org Imenu and Speedbar"
1162 :group 'org-structure)
1164 (defcustom org-imenu-depth 2
1165 "The maximum level for Imenu access to Org-mode headlines.
1166 This also applied for speedbar access."
1167 :group 'org-imenu-and-speedbar
1170 (defgroup org-table nil
1171 "Options concerning tables in Org-mode."
1175 (defcustom org-enable-table-editor 'optimized
1176 "Non-nil means lines starting with \"|\" are handled by the table editor.
1177 When nil, such lines will be treated like ordinary lines.
1179 When equal to the symbol `optimized', the table editor will be optimized to
1181 - Automatic overwrite mode in front of whitespace in table fields.
1182 This makes the structure of the table stay in tact as long as the edited
1183 field does not exceed the column width.
1184 - Minimize the number of realigns. Normally, the table is aligned each time
1185 TAB or RET are pressed to move to another field. With optimization this
1186 happens only if changes to a field might have changed the column width.
1187 Optimization requires replacing the functions `self-insert-command',
1188 `delete-char', and `backward-delete-char' in Org-mode buffers, with a
1189 slight (in fact: unnoticeable) speed impact for normal typing. Org-mode is
1190 very good at guessing when a re-align will be necessary, but you can always
1191 force one with \\[org-ctrl-c-ctrl-c].
1193 If you would like to use the optimized version in Org-mode, but the
1194 un-optimized version in OrgTbl-mode, see the variable `orgtbl-optimized'.
1196 This variable can be used to turn on and off the table editor during a session,
1197 but in order to toggle optimization, a restart is required.
1199 See also the variable `org-table-auto-blank-field'."
1202 (const :tag "off" nil)
1204 (const :tag "on, optimized" optimized)))
1206 (defcustom org-self-insert-cluster-for-undo t
1207 "Non-nil means cluster self-insert commands for undo when possible.
1208 If this is set, then, like in the Emacs command loop, 20 consecutive
1209 characters will be undone together.
1210 This is configurable, because there is some impact on typing performance."
1214 (defcustom org-table-tab-recognizes-table.el t
1215 "Non-nil means TAB will automatically notice a table.el table.
1216 When it sees such a table, it moves point into it and - if necessary -
1217 calls `table-recognize-table'."
1218 :group 'org-table-editing
1221 (defgroup org-link nil
1222 "Options concerning links in Org-mode."
1226 (defvar org-link-abbrev-alist-local nil
1227 "Buffer-local version of `org-link-abbrev-alist', which see.
1228 The value of this is taken from the #+LINK lines.")
1229 (make-variable-buffer-local 'org-link-abbrev-alist-local)
1231 (defcustom org-link-abbrev-alist nil
1232 "Alist of link abbreviations.
1233 The car of each element is a string, to be replaced at the start of a link.
1234 The cdrs are replacement values, like (\"linkkey\" . REPLACE). Abbreviated
1235 links in Org-mode buffers can have an optional tag after a double colon, e.g.
1237 [[linkkey:tag][description]]
1239 The 'linkkey' must be a word word, starting with a letter, followed
1240 by letters, numbers, '-' or '_'.
1242 If REPLACE is a string, the tag will simply be appended to create the link.
1243 If the string contains \"%s\", the tag will be inserted there. Alternatively,
1244 the placeholder \"%h\" will cause a url-encoded version of the tag to
1245 be inserted at that point (see the function `url-hexify-string').
1247 REPLACE may also be a function that will be called with the tag as the
1248 only argument to create the link, which should be returned as a string.
1250 See the manual for examples."
1254 (string :tag "Protocol")
1256 (string :tag "Format")
1259 (defcustom org-descriptive-links t
1260 "Non-nil means hide link part and only show description of bracket links.
1261 Bracket links are like [[link][description]]. This variable sets the initial
1262 state in new org-mode buffers. The setting can then be toggled on a
1263 per-buffer basis from the Org->Hyperlinks menu."
1267 (defcustom org-link-file-path-type 'adaptive
1268 "How the path name in file links should be stored.
1271 relative Relative to the current directory, i.e. the directory of the file
1272 into which the link is being inserted.
1273 absolute Absolute path, if possible with ~ for home directory.
1274 noabbrev Absolute path, no abbreviation of home directory.
1275 adaptive Use relative path for files in the current directory and sub-
1276 directories of it. For other files, use an absolute path."
1284 (defcustom org-activate-links '(bracket angle plain radio tag date footnote)
1285 "Types of links that should be activated in Org-mode files.
1286 This is a list of symbols, each leading to the activation of a certain link
1287 type. In principle, it does not hurt to turn on most link types - there may
1288 be a small gain when turning off unused link types. The types are:
1290 bracket The recommended [[link][description]] or [[link]] links with hiding.
1291 angle Links in angular brackets that may contain whitespace like
1292 <bbdb:Carsten Dominik>.
1293 plain Plain links in normal text, no whitespace, like http://google.com.
1294 radio Text that is matched by a radio target, see manual for details.
1295 tag Tag settings in a headline (link to tag search).
1296 date Time stamps (link to calendar).
1297 footnote Footnote labels.
1299 Changing this variable requires a restart of Emacs to become effective."
1301 :type '(set :greedy t
1302 (const :tag "Double bracket links" bracket)
1303 (const :tag "Angular bracket links" angle)
1304 (const :tag "Plain text links" plain)
1305 (const :tag "Radio target matches" radio)
1306 (const :tag "Tags" tag)
1307 (const :tag "Timestamps" date)
1308 (const :tag "Footnotes" footnote)))
1310 (defcustom org-make-link-description-function nil
1311 "Function to use to generate link descriptions from links.
1312 If nil the link location will be used. This function must take
1313 two parameters; the first is the link and the second the
1314 description `org-insert-link' has generated, and should return the
1315 description to use."
1319 (defgroup org-link-store nil
1320 "Options concerning storing links in Org-mode."
1321 :tag "Org Store Link"
1324 (defcustom org-email-link-description-format "Email %c: %.30s"
1325 "Format of the description part of a link to an email or usenet message.
1326 The following %-escapes will be replaced by corresponding information:
1328 %F full \"From\" field
1329 %f name, taken from \"From\" field, address if no name
1330 %T full \"To\" field
1331 %t first name in \"To\" field, address if no name
1332 %c correspondent. Usually \"from NAME\", but if you sent it yourself, it
1333 will be \"to NAME\". See also the variable `org-from-is-user-regexp'.
1338 You may use normal field width specification between the % and the letter.
1339 This is for example useful to limit the length of the subject.
1341 Examples: \"%f on: %.30s\", \"Email from %f\", \"Email %c\""
1342 :group 'org-link-store
1345 (defcustom org-from-is-user-regexp
1347 (when (and user-mail-address (not (string= user-mail-address "")))
1348 (setq r1 (concat "\\<" (regexp-quote user-mail-address) "\\>")))
1349 (when (and user-full-name (not (string= user-full-name "")))
1350 (setq r2 (concat "\\<" (regexp-quote user-full-name) "\\>")))
1351 (if (and r1 r2) (concat r1 "\\|" r2) (or r1 r2)))
1352 "Regexp matched against the \"From:\" header of an email or usenet message.
1353 It should match if the message is from the user him/herself."
1354 :group 'org-link-store
1357 (defcustom org-link-to-org-use-id 'create-if-interactive-and-no-custom-id
1358 "Non-nil means storing a link to an Org file will use entry IDs.
1360 Note that before this variable is even considered, org-id must be loaded,
1361 so please customize `org-modules' and turn it on.
1363 The variable can have the following values:
1365 t Create an ID if needed to make a link to the current entry.
1367 create-if-interactive
1368 If `org-store-link' is called directly (interactively, as a user
1369 command), do create an ID to support the link. But when doing the
1370 job for remember, only use the ID if it already exists. The
1371 purpose of this setting is to avoid proliferation of unwanted
1372 IDs, just because you happen to be in an Org file when you
1373 call `org-remember' that automatically and preemptively
1374 creates a link. If you do want to get an ID link in a remember
1375 template to an entry not having an ID, create it first by
1376 explicitly creating a link to it, using `C-c C-l' first.
1378 create-if-interactive-and-no-custom-id
1379 Like create-if-interactive, but do not create an ID if there is
1380 a CUSTOM_ID property defined in the entry. This is the default.
1383 Use existing ID, do not create one.
1385 nil Never use an ID to make a link, instead link using a text search for
1387 :group 'org-link-store
1389 (const :tag "Create ID to make link" t)
1390 (const :tag "Create if storing link interactively"
1391 create-if-interactive)
1392 (const :tag "Create if storing link interactively and no CUSTOM_ID is present"
1393 create-if-interactive-and-no-custom-id)
1394 (const :tag "Only use existing" use-existing)
1395 (const :tag "Do not use ID to create link" nil)))
1397 (defcustom org-context-in-file-links t
1398 "Non-nil means file links from `org-store-link' contain context.
1399 A search string will be added to the file name with :: as separator and
1400 used to find the context when the link is activated by the command
1401 `org-open-at-point'. When this option is t, the entire active region
1402 will be placed in the search string of the file link. If set to a
1403 positive integer, only the first n lines of context will be stored.
1405 Using a prefix arg to the command \\[org-store-link] (`org-store-link')
1406 negates this setting for the duration of the command."
1407 :group 'org-link-store
1408 :type '(choice boolean integer))
1410 (defcustom org-keep-stored-link-after-insertion nil
1411 "Non-nil means keep link in list for entire session.
1413 The command `org-store-link' adds a link pointing to the current
1414 location to an internal list. These links accumulate during a session.
1415 The command `org-insert-link' can be used to insert links into any
1416 Org-mode file (offering completion for all stored links). When this
1417 option is nil, every link which has been inserted once using \\[org-insert-link]
1418 will be removed from the list, to make completing the unused links
1420 :group 'org-link-store
1423 (defgroup org-link-follow nil
1424 "Options concerning following links in Org-mode."
1425 :tag "Org Follow Link"
1428 (defcustom org-link-translation-function nil
1429 "Function to translate links with different syntax to Org syntax.
1430 This can be used to translate links created for example by the Planner
1431 or emacs-wiki packages to Org syntax.
1432 The function must accept two parameters, a TYPE containing the link
1433 protocol name like \"rmail\" or \"gnus\" as a string, and the linked path,
1434 which is everything after the link protocol. It should return a cons
1435 with possibly modified values of type and path.
1436 Org contains a function for this, so if you set this variable to
1437 `org-translate-link-from-planner', you should be able follow many
1438 links created by planner."
1439 :group 'org-link-follow
1442 (defcustom org-follow-link-hook nil
1443 "Hook that is run after a link has been followed."
1444 :group 'org-link-follow
1447 (defcustom org-tab-follows-link nil
1448 "Non-nil means on links TAB will follow the link.
1449 Needs to be set before org.el is loaded.
1450 This really should not be used, it does not make sense, and the
1451 implementation is bad."
1452 :group 'org-link-follow
1455 (defcustom org-return-follows-link nil
1456 "Non-nil means on links RET will follow the link."
1457 :group 'org-link-follow
1460 (defcustom org-mouse-1-follows-link
1461 (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t)
1462 "Non-nil means mouse-1 on a link will follow the link.
1463 A longer mouse click will still set point. Does not work on XEmacs.
1464 Needs to be set before org.el is loaded."
1465 :group 'org-link-follow
1468 (defcustom org-mark-ring-length 4
1469 "Number of different positions to be recorded in the ring.
1470 Changing this requires a restart of Emacs to work correctly."
1471 :group 'org-link-follow
1474 (defcustom org-link-search-must-match-exact-headline 'query-to-create
1475 "Non-nil means internal links in Org files must exactly match a headline.
1476 When nil, the link search tries to match a phrase with all words
1477 in the search text."
1478 :group 'org-link-follow
1480 (const :tag "Use fuzy text search" nil)
1481 (const :tag "Match only exact headline" t)
1482 (const :tag "Match extact headline or query to create it"
1485 (defcustom org-link-frame-setup
1486 '((vm . vm-visit-folder-other-frame)
1487 (gnus . org-gnus-no-new-news)
1488 (file . find-file-other-window)
1489 (wl . wl-other-frame))
1490 "Setup the frame configuration for following links.
1491 When following a link with Emacs, it may often be useful to display
1492 this link in another window or frame. This variable can be used to
1493 set this up for the different types of links.
1496 `vm-visit-folder-other-window'
1497 `vm-visit-folder-other-frame'
1498 For Gnus, use any of
1501 `org-gnus-no-new-news'
1502 For FILE, use any of
1504 `find-file-other-window'
1505 `find-file-other-frame'
1506 For Wanderlust use any of
1509 For the calendar, use the variable `calendar-setup'.
1510 For BBDB, it is currently only possible to display the matches in
1512 :group 'org-link-follow
1516 (const vm-visit-folder)
1517 (const vm-visit-folder-other-window)
1518 (const vm-visit-folder-other-frame)))
1522 (const gnus-other-frame)
1523 (const org-gnus-no-new-news)))
1527 (const find-file-other-window)
1528 (const find-file-other-frame)))
1532 (const wl-other-frame)))))
1534 (defcustom org-display-internal-link-with-indirect-buffer nil
1535 "Non-nil means use indirect buffer to display infile links.
1536 Activating internal links (from one location in a file to another location
1537 in the same file) normally just jumps to the location. When the link is
1538 activated with a \\[universal-argument] prefix (or with mouse-3), the link \
1540 another window. When this option is set, the other window actually displays
1541 an indirect buffer clone of the current buffer, to avoid any visibility
1542 changes to the current buffer."
1543 :group 'org-link-follow
1546 (defcustom org-open-non-existing-files nil
1547 "Non-nil means `org-open-file' will open non-existing files.
1548 When nil, an error will be generated.
1549 This variable applies only to external applications because they
1550 might choke on non-existing files. If the link is to a file that
1551 will be opened in Emacs, the variable is ignored."
1552 :group 'org-link-follow
1555 (defcustom org-open-directory-means-index-dot-org nil
1556 "Non-nil means a link to a directory really means to index.org.
1557 When nil, following a directory link will run dired or open a finder/explorer
1558 window on that directory."
1559 :group 'org-link-follow
1562 (defcustom org-link-mailto-program '(browse-url "mailto:%a?subject=%s")
1563 "Function and arguments to call for following mailto links.
1564 This is a list with the first element being a Lisp function, and the
1565 remaining elements being arguments to the function. In string arguments,
1566 %a will be replaced by the address, and %s will be replaced by the subject
1567 if one was given like in <mailto:arthur@galaxy.org::this subject>."
1568 :group 'org-link-follow
1570 (const :tag "browse-url" (browse-url-mail "mailto:%a?subject=%s"))
1571 (const :tag "compose-mail" (compose-mail "%a" "%s"))
1572 (const :tag "message-mail" (message-mail "%a" "%s"))
1573 (cons :tag "other" (function) (repeat :tag "argument" sexp))))
1575 (defcustom org-confirm-shell-link-function 'yes-or-no-p
1576 "Non-nil means ask for confirmation before executing shell links.
1577 Shell links can be dangerous: just think about a link
1579 [[shell:rm -rf ~/*][Google Search]]
1581 This link would show up in your Org-mode document as \"Google Search\",
1582 but really it would remove your entire home directory.
1583 Therefore we advise against setting this variable to nil.
1584 Just change it to `y-or-n-p' if you want to confirm with a
1585 single keystroke rather than having to type \"yes\"."
1586 :group 'org-link-follow
1588 (const :tag "with yes-or-no (safer)" yes-or-no-p)
1589 (const :tag "with y-or-n (faster)" y-or-n-p)
1590 (const :tag "no confirmation (dangerous)" nil)))
1591 (put 'org-confirm-shell-link-function
1592 'safe-local-variable
1593 #'(lambda (x) (member x '(yes-or-no-p y-or-n-p))))
1595 (defcustom org-confirm-shell-link-not-regexp ""
1596 "A regexp to skip confirmation for shell links."
1597 :group 'org-link-follow
1600 (defcustom org-confirm-elisp-link-function 'yes-or-no-p
1601 "Non-nil means ask for confirmation before executing Emacs Lisp links.
1602 Elisp links can be dangerous: just think about a link
1604 [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]]
1606 This link would show up in your Org-mode document as \"Google Search\",
1607 but really it would remove your entire home directory.
1608 Therefore we advise against setting this variable to nil.
1609 Just change it to `y-or-n-p' if you want to confirm with a
1610 single keystroke rather than having to type \"yes\"."
1611 :group 'org-link-follow
1613 (const :tag "with yes-or-no (safer)" yes-or-no-p)
1614 (const :tag "with y-or-n (faster)" y-or-n-p)
1615 (const :tag "no confirmation (dangerous)" nil)))
1616 (put 'org-confirm-shell-link-function
1617 'safe-local-variable
1618 #'(lambda (x) (member x '(yes-or-no-p y-or-n-p))))
1620 (defcustom org-confirm-elisp-link-not-regexp ""
1621 "A regexp to skip confirmation for Elisp links."
1622 :group 'org-link-follow
1625 (defconst org-file-apps-defaults-gnu
1629 "Default file applications on a UNIX or GNU/Linux system.
1630 See `org-file-apps'.")
1632 (defconst org-file-apps-defaults-macosx
1635 (system . "open %s")
1637 ("eps.gz" . "gv %s")
1639 ("fig" . "xfig %s"))
1640 "Default file applications on a MacOS X system.
1641 The system \"open\" is known as a default, but we use X11 applications
1642 for some files for which the OS does not have a good default.
1643 See `org-file-apps'.")
1645 (defconst org-file-apps-defaults-windowsnt
1649 (list (if (featurep 'xemacs)
1650 'mswindows-shell-execute
1654 (list (if (featurep 'xemacs)
1655 'mswindows-shell-execute
1658 "Default file applications on a Windows NT system.
1659 The system \"open\" is used for most files.
1660 See `org-file-apps'.")
1662 (defcustom org-file-apps
1665 ("\\.mm\\'" . default)
1666 ("\\.x?html?\\'" . default)
1667 ("\\.pdf\\'" . default)
1669 "External applications for opening `file:path' items in a document.
1670 Org-mode uses system defaults for different file types, but
1671 you can use this variable to set the application for a given file
1672 extension. The entries in this list are cons cells where the car identifies
1673 files and the cdr the corresponding command. Possible values for the
1675 \"string\" A string as a file identifier can be interpreted in different
1676 ways, depending on its contents:
1678 - Alphanumeric characters only:
1679 Match links with this file extension.
1680 Example: (\"pdf\" . \"evince %s\")
1681 to open PDFs with evince.
1683 - Regular expression: Match links where the
1684 filename matches the regexp. If you want to
1685 use groups here, use shy groups.
1687 Example: (\"\\.x?html\\'\" . \"firefox %s\")
1688 (\"\\(?:xhtml\\|html\\)\" . \"firefox %s\")
1689 to open *.html and *.xhtml with firefox.
1691 - Regular expression which contains (non-shy) groups:
1692 Match links where the whole link, including \"::\", and
1693 anything after that, matches the regexp.
1694 In a custom command string, %1, %2, etc. are replaced with
1695 the parts of the link that were matched by the groups.
1696 For backwards compatibility, if a command string is given
1697 that does not use any of the group matches, this case is
1698 handled identically to the second one (i.e. match against
1700 In a custom lisp form, you can access the group matches with
1701 (match-string n link).
1703 Example: (\"\\.pdf::\\(\\d+\\)\\'\" . \"evince -p %1 %s\")
1704 to open [[file:document.pdf::5]] with evince at page 5.
1706 `directory' Matches a directory
1707 `remote' Matches a remote file, accessible through tramp or efs.
1708 Remote files most likely should be visited through Emacs
1709 because external applications cannot handle such paths.
1710 `auto-mode' Matches files that are matched by any entry in `auto-mode-alist',
1711 so all files Emacs knows how to handle. Using this with
1712 command `emacs' will open most files in Emacs. Beware that this
1713 will also open html files inside Emacs, unless you add
1714 (\"html\" . default) to the list as well.
1715 t Default for files not matched by any of the other options.
1716 `system' The system command to open files, like `open' on Windows
1717 and Mac OS X, and mailcap under GNU/Linux. This is the command
1718 that will be selected if you call `C-c C-o' with a double
1719 \\[universal-argument] \\[universal-argument] prefix.
1721 Possible values for the command are:
1722 `emacs' The file will be visited by the current Emacs process.
1723 `default' Use the default application for this file type, which is the
1724 association for t in the list, most likely in the system-specific
1726 This can be used to overrule an unwanted setting in the
1727 system-specific variable.
1728 `system' Use the system command for opening files, like \"open\".
1729 This command is specified by the entry whose car is `system'.
1730 Most likely, the system-specific version of this variable
1731 does define this command, but you can overrule/replace it
1733 string A command to be executed by a shell; %s will be replaced
1734 by the path to the file.
1735 sexp A Lisp form which will be evaluated. The file path will
1736 be available in the Lisp variable `file'.
1737 For more examples, see the system specific constants
1738 `org-file-apps-defaults-macosx'
1739 `org-file-apps-defaults-windowsnt'
1740 `org-file-apps-defaults-gnu'."
1741 :group 'org-link-follow
1743 (cons (choice :value ""
1744 (string :tag "Extension")
1745 (const :tag "System command to open files" system)
1746 (const :tag "Default for unrecognized files" t)
1747 (const :tag "Remote file" remote)
1748 (const :tag "Links to a directory" directory)
1749 (const :tag "Any files that have Emacs modes"
1752 (const :tag "Visit with Emacs" emacs)
1753 (const :tag "Use default" default)
1754 (const :tag "Use the system command" system)
1755 (string :tag "Command")
1756 (sexp :tag "Lisp form")))))
1760 (defgroup org-refile nil
1761 "Options concerning refiling entries in Org-mode."
1765 (defcustom org-directory "~/org"
1766 "Directory with org files.
1767 This is just a default location to look for Org files. There is no need
1768 at all to put your files into this directory. It is only used in the
1769 following situations:
1771 1. When a remember template specifies a target file that is not an
1772 absolute path. The path will then be interpreted relative to
1774 2. When a remember note is filed away in an interactive way (when exiting the
1775 note buffer with `C-1 C-c C-c'. The user is prompted for an org file,
1776 with `org-directory' as the default path."
1778 :group 'org-remember
1781 (defcustom org-default-notes-file (convert-standard-filename "~/.notes")
1782 "Default target for storing notes.
1783 Used as a fall back file for org-remember.el and org-capture.el, for
1784 templates that do not specify a target file."
1786 :group 'org-remember
1788 (const :tag "Default from remember-data-file" nil)
1791 (defcustom org-goto-interface 'outline
1792 "The default interface to be used for `org-goto'.
1794 outline The interface shows an outline of the relevant file
1795 and the correct heading is found by moving through
1796 the outline or by searching with incremental search.
1797 outline-path-completion Headlines in the current buffer are offered via
1798 completion. This is the interface also used by
1799 the refile command."
1802 (const :tag "Outline" outline)
1803 (const :tag "Outline-path-completion" outline-path-completion)))
1805 (defcustom org-goto-max-level 5
1806 "Maximum target level when running `org-goto' with refile interface."
1810 (defcustom org-reverse-note-order nil
1811 "Non-nil means store new notes at the beginning of a file or entry.
1812 When nil, new notes will be filed to the end of a file or entry.
1813 This can also be a list with cons cells of regular expressions that
1814 are matched against file names, and values."
1815 :group 'org-remember
1818 (const :tag "Reverse always" t)
1819 (const :tag "Reverse never" nil)
1820 (repeat :tag "By file name regexp"
1821 (cons regexp boolean))))
1823 (defcustom org-log-refile nil
1824 "Information to record when a task is refiled.
1826 Possible values are:
1828 nil Don't add anything
1829 time Add a time stamp to the task
1830 note Prompt for a note and add it with template `org-log-note-headings'
1832 This option can also be set with on a per-file-basis with
1834 #+STARTUP: nologrefile
1835 #+STARTUP: logrefile
1836 #+STARTUP: lognoterefile
1838 You can have local logging settings for a subtree by setting the LOGGING
1839 property to one or more of these keywords.
1841 When bulk-refiling from the agenda, the value `note' is forbidden and
1842 will temporarily be changed to `time'."
1844 :group 'org-progress
1846 (const :tag "No logging" nil)
1847 (const :tag "Record timestamp" time)
1848 (const :tag "Record timestamp with note." note)))
1850 (defcustom org-refile-targets nil
1851 "Targets for refiling entries with \\[org-refile].
1852 This is list of cons cells. Each cell contains:
1853 - a specification of the files to be considered, either a list of files,
1854 or a symbol whose function or variable value will be used to retrieve
1855 a file name or a list of file names. If you use `org-agenda-files' for
1856 that, all agenda files will be scanned for targets. Nil means consider
1857 headings in the current buffer.
1858 - A specification of how to find candidate refile targets. This may be
1860 - a cons cell (:tag . \"TAG\") to identify refile targets by a tag.
1861 This tag has to be present in all target headlines, inheritance will
1863 - a cons cell (:todo . \"KEYWORD\") to identify refile targets by
1865 - a cons cell (:regexp . \"REGEXP\") with a regular expression matching
1866 headlines that are refiling targets.
1867 - a cons cell (:level . N). Any headline of level N is considered a target.
1868 Note that, when `org-odd-levels-only' is set, level corresponds to
1869 order in hierarchy, not to the number of stars.
1870 - a cons cell (:maxlevel . N). Any headline with level <= N is a target.
1871 Note that, when `org-odd-levels-only' is set, level corresponds to
1872 order in hierarchy, not to the number of stars.
1874 You can set the variable `org-refile-target-verify-function' to a function
1875 to verify each headline found by the simple criteria above.
1877 When this variable is nil, all top-level headlines in the current buffer
1878 are used, equivalent to the value `((nil . (:level . 1))'."
1882 (choice :value org-agenda-files
1883 (const :tag "All agenda files" org-agenda-files)
1884 (const :tag "Current buffer" nil)
1885 (function) (variable) (file))
1886 (choice :tag "Identify target headline by"
1887 (cons :tag "Specific tag" (const :value :tag) (string))
1888 (cons :tag "TODO keyword" (const :value :todo) (string))
1889 (cons :tag "Regular expression" (const :value :regexp) (regexp))
1890 (cons :tag "Level number" (const :value :level) (integer))
1891 (cons :tag "Max Level number" (const :value :maxlevel) (integer))))))
1893 (defcustom org-refile-target-verify-function nil
1894 "Function to verify if the headline at point should be a refile target.
1895 The function will be called without arguments, with point at the
1896 beginning of the headline. It should return t and leave point
1897 where it is if the headline is a valid target for refiling.
1899 If the target should not be selected, the function must return nil.
1900 In addition to this, it may move point to a place from where the search
1901 should be continued. For example, the function may decide that the entire
1902 subtree of the current entry should be excluded and move point to the end
1907 (defcustom org-refile-use-cache nil
1908 "Non-nil means cache refile targets to speed up the process.
1909 The cache for a particular file will be updated automatically when
1910 the buffer has been killed, or when any of the marker used for flagging
1911 refile targets no longer points at a live buffer.
1912 If you have added new entries to a buffer that might themselves be targets,
1913 you need to clear the cache manually by pressing `C-0 C-c C-w' or, if you
1914 find that easier, `C-u C-u C-u C-c C-w'."
1918 (defcustom org-refile-use-outline-path nil
1919 "Non-nil means provide refile targets as paths.
1920 So a level 3 headline will be available as level1/level2/level3.
1922 When the value is `file', also include the file name (without directory)
1923 into the path. In this case, you can also stop the completion after
1924 the file name, to get entries inserted as top level in the file.
1926 When `full-file-path', include the full file path."
1929 (const :tag "Not" nil)
1930 (const :tag "Yes" t)
1931 (const :tag "Start with file name" file)
1932 (const :tag "Start with full file path" full-file-path)))
1934 (defcustom org-outline-path-complete-in-steps t
1935 "Non-nil means complete the outline path in hierarchical steps.
1936 When Org-mode uses the refile interface to select an outline path
1937 \(see variable `org-refile-use-outline-path'), the completion of
1938 the path can be done is a single go, or if can be done in steps down
1939 the headline hierarchy. Going in steps is probably the best if you
1940 do not use a special completion package like `ido' or `icicles'.
1941 However, when using these packages, going in one step can be very
1942 fast, while still showing the whole path to the entry."
1946 (defcustom org-refile-allow-creating-parent-nodes nil
1947 "Non-nil means allow to create new nodes as refile targets.
1948 New nodes are then created by adding \"/new node name\" to the completion
1949 of an existing node. When the value of this variable is `confirm',
1950 new node creation must be confirmed by the user (recommended)
1951 When nil, the completion must match an existing entry.
1953 Note that, if the new heading is not seen by the criteria
1954 listed in `org-refile-targets', multiple instances of the same
1955 heading would be created by trying again to file under the new
1959 (const :tag "Never" nil)
1960 (const :tag "Always" t)
1961 (const :tag "Prompt for confirmation" confirm)))
1963 (defgroup org-todo nil
1964 "Options concerning TODO items in Org-mode."
1968 (defgroup org-progress nil
1969 "Options concerning Progress logging in Org-mode."
1973 (defvar org-todo-interpretation-widgets
1975 (:tag "Sequence (cycling hits every state)" sequence)
1976 (:tag "Type (cycling directly to DONE)" type))
1977 "The available interpretation symbols for customizing `org-todo-keywords'.
1978 Interested libraries should add to this list.")
1980 (defcustom org-todo-keywords '((sequence "TODO" "DONE"))
1981 "List of TODO entry keyword sequences and their interpretation.
1982 \\<org-mode-map>This is a list of sequences.
1984 Each sequence starts with a symbol, either `sequence' or `type',
1985 indicating if the keywords should be interpreted as a sequence of
1986 action steps, or as different types of TODO items. The first
1987 keywords are states requiring action - these states will select a headline
1988 for inclusion into the global TODO list Org-mode produces. If one of
1989 the \"keywords\" is the vertical bar, \"|\", the remaining keywords
1990 signify that no further action is necessary. If \"|\" is not found,
1991 the last keyword is treated as the only DONE state of the sequence.
1993 The command \\[org-todo] cycles an entry through these states, and one
1994 additional state where no keyword is present. For details about this
1995 cycling, see the manual.
1997 TODO keywords and interpretation can also be set on a per-file basis with
1998 the special #+SEQ_TODO and #+TYP_TODO lines.
2000 Each keyword can optionally specify a character for fast state selection
2001 \(in combination with the variable `org-use-fast-todo-selection')
2002 and specifiers for state change logging, using the same syntax
2003 that is used in the \"#+TODO:\" lines. For example, \"WAIT(w)\" says
2004 that the WAIT state can be selected with the \"w\" key. \"WAIT(w!)\"
2005 indicates to record a time stamp each time this state is selected.
2007 Each keyword may also specify if a timestamp or a note should be
2008 recorded when entering or leaving the state, by adding additional
2009 characters in the parenthesis after the keyword. This looks like this:
2010 \"WAIT(w@/!)\". \"@\" means to add a note (with time), \"!\" means to
2011 record only the time of the state change. With X and Y being either
2012 \"@\" or \"!\", \"X/Y\" means use X when entering the state, and use
2013 Y when leaving the state if and only if the *target* state does not
2014 define X. You may omit any of the fast-selection key or X or /Y,
2015 so WAIT(w@), WAIT(w/@) and WAIT(@/@) are all valid.
2017 For backward compatibility, this variable may also be just a list
2018 of keywords - in this case the interpretation (sequence or type) will be
2019 taken from the (otherwise obsolete) variable `org-todo-interpretation'."
2021 :group 'org-keywords
2023 (repeat :tag "Old syntax, just keywords"
2024 (string :tag "Keyword"))
2025 (repeat :tag "New syntax"
2028 :tag "Interpretation"
2029 ;;Quick and dirty way to see
2030 ;;`org-todo-interpretations'. This takes the
2031 ;;place of item arguments
2039 org-todo-interpretation-widgets))
2042 (string :tag "Keyword"))))))
2044 (defvar org-todo-keywords-1 nil
2045 "All TODO and DONE keywords active in a buffer.")
2046 (make-variable-buffer-local 'org-todo-keywords-1)
2047 (defvar org-todo-keywords-for-agenda nil)
2048 (defvar org-done-keywords-for-agenda nil)
2049 (defvar org-drawers-for-agenda nil)
2050 (defvar org-todo-keyword-alist-for-agenda nil)
2051 (defvar org-tag-alist-for-agenda nil)
2052 (defvar org-agenda-contributing-files nil)
2053 (defvar org-not-done-keywords nil)
2054 (make-variable-buffer-local 'org-not-done-keywords)
2055 (defvar org-done-keywords nil)
2056 (make-variable-buffer-local 'org-done-keywords)
2057 (defvar org-todo-heads nil)
2058 (make-variable-buffer-local 'org-todo-heads)
2059 (defvar org-todo-sets nil)
2060 (make-variable-buffer-local 'org-todo-sets)
2061 (defvar org-todo-log-states nil)
2062 (make-variable-buffer-local 'org-todo-log-states)
2063 (defvar org-todo-kwd-alist nil)
2064 (make-variable-buffer-local 'org-todo-kwd-alist)
2065 (defvar org-todo-key-alist nil)
2066 (make-variable-buffer-local 'org-todo-key-alist)
2067 (defvar org-todo-key-trigger nil)
2068 (make-variable-buffer-local 'org-todo-key-trigger)
2070 (defcustom org-todo-interpretation 'sequence
2071 "Controls how TODO keywords are interpreted.
2072 This variable is in principle obsolete and is only used for
2073 backward compatibility, if the interpretation of todo keywords is
2074 not given already in `org-todo-keywords'. See that variable for
2077 :group 'org-keywords
2078 :type '(choice (const sequence)
2081 (defcustom org-use-fast-todo-selection t
2082 "Non-nil means use the fast todo selection scheme with C-c C-t.
2083 This variable describes if and under what circumstances the cycling
2084 mechanism for TODO keywords will be replaced by a single-key, direct
2087 When nil, fast selection is never used.
2089 When the symbol `prefix', it will be used when `org-todo' is called with
2090 a prefix argument, i.e. `C-u C-c C-t' in an Org-mode buffer, and `C-u t'
2091 in an agenda buffer.
2093 When t, fast selection is used by default. In this case, the prefix
2094 argument forces cycling instead.
2096 In all cases, the special interface is only used if access keys have actually
2097 been assigned by the user, i.e. if keywords in the configuration are followed
2098 by a letter in parenthesis, like TODO(t)."
2101 (const :tag "Never" nil)
2102 (const :tag "By default" t)
2103 (const :tag "Only with C-u C-c C-t" prefix)))
2105 (defcustom org-provide-todo-statistics t
2106 "Non-nil means update todo statistics after insert and toggle.
2107 ALL-HEADLINES means update todo statistics by including headlines
2108 with no TODO keyword as well, counting them as not done.
2109 A list of TODO keywords means the same, but skip keywords that are
2112 When this is set, todo statistics is updated in the parent of the
2113 current entry each time a todo state is changed."
2116 (const :tag "Yes, only for TODO entries" t)
2117 (const :tag "Yes, including all entries" 'all-headlines)
2118 (repeat :tag "Yes, for TODOs in this list"
2119 (string :tag "TODO keyword"))
2120 (other :tag "No TODO statistics" nil)))
2122 (defcustom org-hierarchical-todo-statistics t
2123 "Non-nil means TODO statistics covers just direct children.
2124 When nil, all entries in the subtree are considered.
2125 This has only an effect if `org-provide-todo-statistics' is set.
2126 To set this to nil for only a single subtree, use a COOKIE_DATA
2127 property and include the word \"recursive\" into the value."
2131 (defcustom org-after-todo-state-change-hook nil
2132 "Hook which is run after the state of a TODO item was changed.
2133 The new state (a string with a TODO keyword, or nil) is available in the
2134 Lisp variable `state'."
2138 (defvar org-blocker-hook nil
2139 "Hook for functions that are allowed to block a state change.
2141 Each function gets as its single argument a property list, see
2142 `org-trigger-hook' for more information about this list.
2144 If any of the functions in this hook returns nil, the state change
2147 (defvar org-trigger-hook nil
2148 "Hook for functions that are triggered by a state change.
2150 Each function gets as its single argument a property list with at least
2151 the following elements:
2153 (:type type-of-change :position pos-at-entry-start
2154 :from old-state :to new-state)
2156 Depending on the type, more properties may be present.
2158 This mechanism is currently implemented for:
2162 :type todo-state-change
2163 :from previous state (keyword as a string), or nil, or a symbol
2164 'todo' or 'done', to indicate the general type of state.
2165 :to new state, like in :from")
2167 (defcustom org-enforce-todo-dependencies nil
2168 "Non-nil means undone TODO entries will block switching the parent to DONE.
2169 Also, if a parent has an :ORDERED: property, switching an entry to DONE will
2170 be blocked if any prior sibling is not yet done.
2171 Finally, if the parent is blocked because of ordered siblings of its own,
2172 the child will also be blocked.
2173 This variable needs to be set before org.el is loaded, and you need to
2174 restart Emacs after a change to make the change effective. The only way
2175 to change is while Emacs is running is through the customize interface."
2176 :set (lambda (var val)
2179 (add-hook 'org-blocker-hook
2180 'org-block-todo-from-children-or-siblings-or-parent)
2181 (remove-hook 'org-blocker-hook
2182 'org-block-todo-from-children-or-siblings-or-parent)))
2186 (defcustom org-enforce-todo-checkbox-dependencies nil
2187 "Non-nil means unchecked boxes will block switching the parent to DONE.
2188 When this is nil, checkboxes have no influence on switching TODO states.
2189 When non-nil, you first need to check off all check boxes before the TODO
2190 entry can be switched to DONE.
2191 This variable needs to be set before org.el is loaded, and you need to
2192 restart Emacs after a change to make the change effective. The only way
2193 to change is while Emacs is running is through the customize interface."
2194 :set (lambda (var val)
2197 (add-hook 'org-blocker-hook
2198 'org-block-todo-from-checkboxes)
2199 (remove-hook 'org-blocker-hook
2200 'org-block-todo-from-checkboxes)))
2204 (defcustom org-treat-insert-todo-heading-as-state-change nil
2205 "Non-nil means inserting a TODO heading is treated as state change.
2206 So when the command \\[org-insert-todo-heading] is used, state change
2207 logging will apply if appropriate. When nil, the new TODO item will
2208 be inserted directly, and no logging will take place."
2212 (defcustom org-treat-S-cursor-todo-selection-as-state-change t
2213 "Non-nil means switching TODO states with S-cursor counts as state change.
2214 This is the default behavior. However, setting this to nil allows a
2215 convenient way to select a TODO state and bypass any logging associated
2220 (defcustom org-todo-state-tags-triggers nil
2221 "Tag changes that should be triggered by TODO state changes.
2222 This is a list. Each entry is
2224 (state-change (tag . flag) .......)
2226 State-change can be a string with a state, and empty string to indicate the
2227 state that has no TODO keyword, or it can be one of the symbols `todo'
2228 or `done', meaning any not-done or done state, respectively."
2232 (cons (choice :tag "When changing to"
2233 (const :tag "Not-done state" todo)
2234 (const :tag "Done state" done)
2235 (string :tag "State"))
2237 (cons :tag "Tag action"
2239 (choice (const :tag "Add" t) (const :tag "Remove" nil)))))))
2241 (defcustom org-log-done nil
2242 "Information to record when a task moves to the DONE state.
2244 Possible values are:
2246 nil Don't add anything, just change the keyword
2247 time Add a time stamp to the task
2248 note Prompt for a note and add it with template `org-log-note-headings'
2250 This option can also be set with on a per-file-basis with
2252 #+STARTUP: nologdone
2254 #+STARTUP: lognotedone
2256 You can have local logging settings for a subtree by setting the LOGGING
2257 property to one or more of these keywords."
2259 :group 'org-progress
2261 (const :tag "No logging" nil)
2262 (const :tag "Record CLOSED timestamp" time)
2263 (const :tag "Record CLOSED timestamp with note." note)))
2265 ;; Normalize old uses of org-log-done.
2267 ((eq org-log-done t) (setq org-log-done 'time))
2268 ((and (listp org-log-done) (memq 'done org-log-done))
2269 (setq org-log-done 'note)))
2271 (defcustom org-log-reschedule nil
2272 "Information to record when the scheduling date of a tasks is modified.
2274 Possible values are:
2276 nil Don't add anything, just change the date
2277 time Add a time stamp to the task
2278 note Prompt for a note and add it with template `org-log-note-headings'
2280 This option can also be set with on a per-file-basis with
2282 #+STARTUP: nologreschedule
2283 #+STARTUP: logreschedule
2284 #+STARTUP: lognotereschedule"
2286 :group 'org-progress
2288 (const :tag "No logging" nil)
2289 (const :tag "Record timestamp" time)
2290 (const :tag "Record timestamp with note." note)))
2292 (defcustom org-log-redeadline nil
2293 "Information to record when the deadline date of a tasks is modified.
2295 Possible values are:
2297 nil Don't add anything, just change the date
2298 time Add a time stamp to the task
2299 note Prompt for a note and add it with template `org-log-note-headings'
2301 This option can also be set with on a per-file-basis with
2303 #+STARTUP: nologredeadline
2304 #+STARTUP: logredeadline
2305 #+STARTUP: lognoteredeadline
2307 You can have local logging settings for a subtree by setting the LOGGING
2308 property to one or more of these keywords."
2310 :group 'org-progress
2312 (const :tag "No logging" nil)
2313 (const :tag "Record timestamp" time)
2314 (const :tag "Record timestamp with note." note)))
2316 (defcustom org-log-note-clock-out nil
2317 "Non-nil means record a note when clocking out of an item.
2318 This can also be configured on a per-file basis by adding one of
2319 the following lines anywhere in the buffer:
2321 #+STARTUP: lognoteclock-out
2322 #+STARTUP: nolognoteclock-out"
2324 :group 'org-progress
2327 (defcustom org-log-done-with-time t
2328 "Non-nil means the CLOSED time stamp will contain date and time.
2329 When nil, only the date will be recorded."
2330 :group 'org-progress
2333 (defcustom org-log-note-headings
2334 '((done . "CLOSING NOTE %t")
2335 (state . "State %-12s from %-12S %t")
2336 (note . "Note taken on %t")
2337 (reschedule . "Rescheduled from %S on %t")
2338 (delschedule . "Not scheduled, was %S on %t")
2339 (redeadline . "New deadline from %S on %t")
2340 (deldeadline . "Removed deadline, was %S on %t")
2341 (refile . "Refiled on %t")
2343 "Headings for notes added to entries.
2344 The value is an alist, with the car being a symbol indicating the note
2345 context, and the cdr is the heading to be used. The heading may also be the
2347 %t in the heading will be replaced by a time stamp.
2348 %T will be an active time stamp instead the default inactive one
2349 %s will be replaced by the new TODO state, in double quotes.
2350 %S will be replaced by the old TODO state, in double quotes.
2351 %u will be replaced by the user name.
2352 %U will be replaced by the full user name.
2354 In fact, it is not a good idea to change the `state' entry, because
2355 agenda log mode depends on the format of these entries."
2357 :group 'org-progress
2358 :type '(list :greedy t
2359 (cons (const :tag "Heading when closing an item" done) string)
2361 "Heading when changing todo state (todo sequence only)"
2363 (cons (const :tag "Heading when just taking a note" note) string)
2364 (cons (const :tag "Heading when clocking out" clock-out) string)
2365 (cons (const :tag "Heading when an item is no longer scheduled" delschedule) string)
2366 (cons (const :tag "Heading when rescheduling" reschedule) string)
2367 (cons (const :tag "Heading when changing deadline" redeadline) string)
2368 (cons (const :tag "Heading when deleting a deadline" deldeadline) string)
2369 (cons (const :tag "Heading when refiling" refile) string)))
2371 (unless (assq 'note org-log-note-headings)
2372 (push '(note . "%t") org-log-note-headings))
2374 (defcustom org-log-into-drawer nil
2375 "Non-nil means insert state change notes and time stamps into a drawer.
2376 When nil, state changes notes will be inserted after the headline and
2377 any scheduling and clock lines, but not inside a drawer.
2379 The value of this variable should be the name of the drawer to use.
2380 LOGBOOK is proposed as the default drawer for this purpose, you can
2381 also set this to a string to define the drawer of your choice.
2383 A value of t is also allowed, representing \"LOGBOOK\".
2385 If this variable is set, `org-log-state-notes-insert-after-drawers'
2388 You can set the property LOG_INTO_DRAWER to overrule this setting for
2391 :group 'org-progress
2393 (const :tag "Not into a drawer" nil)
2394 (const :tag "LOGBOOK" t)
2395 (string :tag "Other")))
2397 (if (fboundp 'defvaralias)
2398 (defvaralias 'org-log-state-notes-into-drawer 'org-log-into-drawer))
2400 (defun org-log-into-drawer ()
2401 "Return the value of `org-log-into-drawer', but let properties overrule.
2402 If the current entry has or inherits a LOG_INTO_DRAWER property, it will be
2403 used instead of the default value."
2404 (let ((p (org-entry-get nil "LOG_INTO_DRAWER" 'inherit)))
2406 ((or (not p) (equal p "nil")) org-log-into-drawer)
2407 ((equal p "t") "LOGBOOK")
2410 (defcustom org-log-state-notes-insert-after-drawers nil
2411 "Non-nil means insert state change notes after any drawers in entry.
2412 Only the drawers that *immediately* follow the headline and the
2413 deadline/scheduled line are skipped.
2414 When nil, insert notes right after the heading and perhaps the line
2415 with deadline/scheduling if present.
2417 This variable will have no effect if `org-log-into-drawer' is
2420 :group 'org-progress
2423 (defcustom org-log-states-order-reversed t
2424 "Non-nil means the latest state note will be directly after heading.
2425 When nil, the state change notes will be ordered according to time."
2427 :group 'org-progress
2430 (defcustom org-todo-repeat-to-state nil
2431 "The TODO state to which a repeater should return the repeating task.
2432 By default this is the first task in a TODO sequence, or the previous state
2433 in a TODO_TYP set. But you can specify another task here.
2434 alternatively, set the :REPEAT_TO_STATE: property of the entry."
2436 :type '(choice (const :tag "Head of sequence" nil)
2437 (string :tag "Specific state")))
2439 (defcustom org-log-repeat 'time
2440 "Non-nil means record moving through the DONE state when triggering repeat.
2441 An auto-repeating task is immediately switched back to TODO when
2442 marked DONE. If you are not logging state changes (by adding \"@\"
2443 or \"!\" to the TODO keyword definition), or set `org-log-done' to
2444 record a closing note, there will be no record of the task moving
2445 through DONE. This variable forces taking a note anyway.
2447 nil Don't force a record
2448 time Record a time stamp
2451 This option can also be set with on a per-file-basis with
2453 #+STARTUP: logrepeat
2454 #+STARTUP: lognoterepeat
2455 #+STARTUP: nologrepeat
2457 You can have local logging settings for a subtree by setting the LOGGING
2458 property to one or more of these keywords."
2460 :group 'org-progress
2462 (const :tag "Don't force a record" nil)
2463 (const :tag "Force recording the DONE state" time)
2464 (const :tag "Force recording a note with the DONE state" note)))
2467 (defgroup org-priorities nil
2468 "Priorities in Org-mode."
2469 :tag "Org Priorities"
2472 (defcustom org-enable-priority-commands t
2473 "Non-nil means priority commands are active.
2474 When nil, these commands will be disabled, so that you never accidentally
2476 :group 'org-priorities
2479 (defcustom org-highest-priority ?A
2480 "The highest priority of TODO items. A character like ?A, ?B etc.
2481 Must have a smaller ASCII number than `org-lowest-priority'."
2482 :group 'org-priorities
2485 (defcustom org-lowest-priority ?C
2486 "The lowest priority of TODO items. A character like ?A, ?B etc.
2487 Must have a larger ASCII number than `org-highest-priority'."
2488 :group 'org-priorities
2491 (defcustom org-default-priority ?B
2492 "The default priority of TODO items.
2493 This is the priority an item gets if no explicit priority is given.
2494 When starting to cycle on an empty priority the first step in the cycle
2495 depends on `org-priority-start-cycle-with-default'. The resulting first
2496 step priority must not exceed the range from `org-highest-priority' to
2497 `org-lowest-priority' which means that `org-default-priority' has to be
2498 in this range exclusive or inclusive the range boundaries. Else the
2499 first step refuses to set the default and the second will fall back
2500 to (depending on the command used) the highest or lowest priority."
2501 :group 'org-priorities
2504 (defcustom org-priority-start-cycle-with-default t
2505 "Non-nil means start with default priority when starting to cycle.
2506 When this is nil, the first step in the cycle will be (depending on the
2507 command used) one higher or lower than the default priority.
2508 See also `org-default-priority'."
2509 :group 'org-priorities
2512 (defcustom org-get-priority-function nil
2513 "Function to extract the priority from a string.
2514 The string is normally the headline. If this is nil Org computes the
2515 priority from the priority cookie like [#A] in the headline. It returns
2516 an integer, increasing by 1000 for each priority level.
2517 The user can set a different function here, which should take a string
2518 as an argument and return the numeric priority."
2519 :group 'org-priorities
2522 (defgroup org-time nil
2523 "Options concerning time stamps and deadlines in Org-mode."
2527 (defcustom org-insert-labeled-timestamps-at-point nil
2528 "Non-nil means SCHEDULED and DEADLINE timestamps are inserted at point.
2529 When nil, these labeled time stamps are forces into the second line of an
2530 entry, just after the headline. When scheduling from the global TODO list,
2531 the time stamp will always be forced into the second line."
2535 (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
2536 "Formats for `format-time-string' which are used for time stamps.
2537 It is not recommended to change this constant.")
2539 (defcustom org-time-stamp-rounding-minutes '(0 5)
2540 "Number of minutes to round time stamps to.
2541 These are two values, the first applies when first creating a time stamp.
2542 The second applies when changing it with the commands `S-up' and `S-down'.
2543 When changing the time stamp, this means that it will change in steps
2544 of N minutes, as given by the second value.
2546 When a setting is 0 or 1, insert the time unmodified. Useful rounding
2547 numbers should be factors of 60, so for example 5, 10, 15.
2549 When this is larger than 1, you can still force an exact time stamp by using
2550 a double prefix argument to a time stamp command like `C-c .' or `C-c !',
2551 and by using a prefix arg to `S-up/down' to specify the exact number
2552 of minutes to shift."
2554 :get #'(lambda (var) ; Make sure both elements are there
2555 (if (integerp (default-value var))
2556 (list (default-value var) 5)
2557 (default-value var)))
2559 (integer :tag "when inserting times")
2560 (integer :tag "when modifying times")))
2562 ;; Normalize old customizations of this variable.
2563 (when (integerp org-time-stamp-rounding-minutes)
2564 (setq org-time-stamp-rounding-minutes
2565 (list org-time-stamp-rounding-minutes
2566 org-time-stamp-rounding-minutes)))
2568 (defcustom org-display-custom-times nil
2569 "Non-nil means overlay custom formats over all time stamps.
2570 The formats are defined through the variable `org-time-stamp-custom-formats'.
2571 To turn this on on a per-file basis, insert anywhere in the file:
2572 #+STARTUP: customtime"
2576 (make-variable-buffer-local 'org-display-custom-times)
2578 (defcustom org-time-stamp-custom-formats
2579 '("<%m/%d/%y %a>" . "<%m/%d/%y %a %H:%M>") ; american
2580 "Custom formats for time stamps. See `format-time-string' for the syntax.
2581 These are overlayed over the default ISO format if the variable
2582 `org-display-custom-times' is set. Time like %H:%M should be at the
2583 end of the second format. The custom formats are also honored by export
2584 commands, if custom time display is turned on at the time of export."
2588 (defun org-time-stamp-format (&optional long inactive)
2589 "Get the right format for a time string."
2590 (let ((f (if long (cdr org-time-stamp-formats)
2591 (car org-time-stamp-formats))))
2593 (concat "[" (substring f 1 -1) "]")
2596 (defcustom org-time-clocksum-format "%d:%02d"
2597 "The format string used when creating CLOCKSUM lines.
2598 This is also used when org-mode generates a time duration."
2602 (defcustom org-time-clocksum-use-fractional nil
2603 "If non-nil, \\[org-clock-display] uses fractional times.
2604 org-mode generates a time duration."
2608 (defcustom org-time-clocksum-fractional-format "%.2f"
2609 "The format string used when creating CLOCKSUM lines, or when
2610 org-mode generates a time duration."
2614 (defcustom org-deadline-warning-days 14
2615 "No. of days before expiration during which a deadline becomes active.
2616 This variable governs the display in sparse trees and in the agenda.
2617 When 0 or negative, it means use this number (the absolute value of it)
2618 even if a deadline has a different individual lead time specified.
2620 Custom commands can set this variable in the options section."
2622 :group 'org-agenda-daily/weekly
2625 (defcustom org-read-date-prefer-future t
2626 "Non-nil means assume future for incomplete date input from user.
2627 This affects the following situations:
2628 1. The user gives a month but not a year.
2629 For example, if it is April and you enter \"feb 2\", this will be read
2630 as Feb 2, *next* year. \"May 5\", however, will be this year.
2631 2. The user gives a day, but no month.
2632 For example, if today is the 15th, and you enter \"3\", Org-mode will
2633 read this as the third of *next* month. However, if you enter \"17\",
2634 it will be considered as *this* month.
2636 If you set this variable to the symbol `time', then also the following
2639 3. If the user gives a time, but no day. If the time is before now,
2640 to will be interpreted as tomorrow.
2642 Currently none of this works for ISO week specifications.
2644 When this option is nil, the current day, month and year will always be
2647 See also `org-agenda-jump-prefer-future'."
2650 (const :tag "Never" nil)
2651 (const :tag "Check month and day" t)
2652 (const :tag "Check month, day, and time" time)))
2654 (defcustom org-agenda-jump-prefer-future 'org-read-date-prefer-future
2655 "Should the agenda jump command prefer the future for incomplete dates?
2656 The default is to do the same as configured in `org-read-date-prefer-future'.
2657 But you can also set a deviating value here.
2658 This may t or nil, or the symbol `org-read-date-prefer-future'."
2662 (const :tag "Use org-read-date-prefer-future"
2663 org-read-date-prefer-future)
2664 (const :tag "Never" nil)
2665 (const :tag "Always" t)))
2667 (defcustom org-read-date-force-compatible-dates t
2668 "Should date/time prompt force dates that are guaranteed to work in Emacs?
2670 Depending on the system Emacs is running on, certain dates cannot
2671 be represented with the type used internally to represent time.
2672 Dates between 1970-1-1 and 2038-1-1 can always be represented
2673 correctly. Some systems allow for earlier dates, some for later,
2674 some for both. One way to find out it to insert any date into an
2675 Org buffer, putting the cursor on the year and hitting S-up and
2676 S-down to test the range.
2678 When this variable is set to t, the date/time prompt will not let
2679 you specify dates outside the 1970-2037 range, so it is certain that
2680 these dates will work in whatever version of Emacs you are
2681 running, and also that you can move a file from one Emacs implementation
2682 to another. WHenever Org is forcing the year for you, it will display
2685 When this variable is nil, Org will check if the date is
2686 representable in the specific Emacs implementation you are using.
2687 If not, it will force a year, usually the current year, and beep
2688 to remind you. Currently this setting is not recommended because
2689 the likelihood that you will open your Org files in an Emacs that
2690 has limited date range is not negligible.
2692 A workaround for this problem is to use diary sexp dates for time
2693 stamps outside of this range."
2697 (defcustom org-read-date-display-live t
2698 "Non-nil means display current interpretation of date prompt live.
2699 This display will be in an overlay, in the minibuffer."
2703 (defcustom org-read-date-popup-calendar t
2704 "Non-nil means pop up a calendar when prompting for a date.
2705 In the calendar, the date can be selected with mouse-1. However, the
2706 minibuffer will also be active, and you can simply enter the date as well.
2707 When nil, only the minibuffer will be available."
2710 (if (fboundp 'defvaralias)
2711 (defvaralias 'org-popup-calendar-for-date-prompt
2712 'org-read-date-popup-calendar))
2714 (defcustom org-read-date-minibuffer-setup-hook nil
2715 "Hook to be used to set up keys for the date/time interface.
2716 Add key definitions to `minibuffer-local-map', which will be a temporary
2721 (defcustom org-extend-today-until 0
2722 "The hour when your day really ends. Must be an integer.
2723 This has influence for the following applications:
2724 - When switching the agenda to \"today\". It it is still earlier than
2725 the time given here, the day recognized as TODAY is actually yesterday.
2726 - When a date is read from the user and it is still before the time given
2727 here, the current date and time will be assumed to be yesterday, 23:59.
2728 Also, timestamps inserted in remember templates follow this rule.
2730 IMPORTANT: This is a feature whose implementation is and likely will
2731 remain incomplete. Really, it is only here because past midnight seems to
2732 be the favorite working time of John Wiegley :-)"
2736 (defcustom org-edit-timestamp-down-means-later nil
2737 "Non-nil means S-down will increase the time in a time stamp.
2738 When nil, S-up will increase."
2742 (defcustom org-calendar-follow-timestamp-change t
2743 "Non-nil means make the calendar window follow timestamp changes.
2744 When a timestamp is modified and the calendar window is visible, it will be
2745 moved to the new date."
2749 (defgroup org-tags nil
2750 "Options concerning tags in Org-mode."
2754 (defcustom org-tag-alist nil
2755 "List of tags allowed in Org-mode files.
2756 When this list is nil, Org-mode will base TAG input on what is already in the
2758 The value of this variable is an alist, the car of each entry must be a
2759 keyword as a string, the cdr may be a character that is used to select
2760 that tag through the fast-tag-selection interface.
2761 See the manual for details."
2765 (cons (string :tag "Tag name")
2766 (character :tag "Access char"))
2767 (list :tag "Start radio group"
2769 (option (string :tag "Group description")))
2770 (list :tag "End radio group"
2772 (option (string :tag "Group description")))
2773 (const :tag "New line" (:newline)))))
2775 (defcustom org-tag-persistent-alist nil
2776 "List of tags that will always appear in all Org-mode files.
2777 This is in addition to any in buffer settings or customizations
2779 When this list is nil, Org-mode will base TAG input on `org-tag-alist'.
2780 The value of this variable is an alist, the car of each entry must be a
2781 keyword as a string, the cdr may be a character that is used to select
2782 that tag through the fast-tag-selection interface.
2783 See the manual for details.
2784 To disable these tags on a per-file basis, insert anywhere in the file:
2789 (cons (string :tag "Tag name")
2790 (character :tag "Access char"))
2791 (const :tag "Start radio group" (:startgroup))
2792 (const :tag "End radio group" (:endgroup))
2793 (const :tag "New line" (:newline)))))
2795 (defcustom org-complete-tags-always-offer-all-agenda-tags nil
2796 "If non-nil, always offer completion for all tags of all agenda files.
2797 Instead of customizing this variable directly, you might want to
2798 set it locally for capture buffers, because there no list of
2799 tags in that file can be created dynamically (there are none).
2801 (add-hook 'org-capture-mode-hook
2803 (set (make-local-variable
2804 'org-complete-tags-always-offer-all-agenda-tags)
2809 (defvar org-file-tags nil
2810 "List of tags that can be inherited by all entries in the file.
2811 The tags will be inherited if the variable `org-use-tag-inheritance'
2812 says they should be.
2813 This variable is populated from #+FILETAGS lines.")
2815 (defcustom org-use-fast-tag-selection 'auto
2816 "Non-nil means use fast tag selection scheme.
2817 This is a special interface to select and deselect tags with single keys.
2818 When nil, fast selection is never used.
2819 When the symbol `auto', fast selection is used if and only if selection
2820 characters for tags have been configured, either through the variable
2821 `org-tag-alist' or through a #+TAGS line in the buffer.
2822 When t, fast selection is always used and selection keys are assigned
2823 automatically if necessary."
2826 (const :tag "Always" t)
2827 (const :tag "Never" nil)
2828 (const :tag "When selection characters are configured" 'auto)))
2830 (defcustom org-fast-tag-selection-single-key nil
2831 "Non-nil means fast tag selection exits after first change.
2832 When nil, you have to press RET to exit it.
2833 During fast tag selection, you can toggle this flag with `C-c'.
2834 This variable can also have the value `expert'. In this case, the window
2835 displaying the tags menu is not even shown, until you press C-c again."
2838 (const :tag "No" nil)
2839 (const :tag "Yes" t)
2840 (const :tag "Expert" expert)))
2842 (defvar org-fast-tag-selection-include-todo nil
2843 "Non-nil means fast tags selection interface will also offer TODO states.
2844 This is an undocumented feature, you should not rely on it.")
2846 (defcustom org-tags-column (if (featurep 'xemacs) -76 -77)
2847 "The column to which tags should be indented in a headline.
2848 If this number is positive, it specifies the column. If it is negative,
2849 it means that the tags should be flushright to that column. For example,
2850 -80 works well for a normal 80 character screen."
2854 (defcustom org-auto-align-tags t
2855 "Non-nil keeps tags aligned when modifying headlines.
2856 Some operations (i.e. demoting) change the length of a headline and
2857 therefore shift the tags around. With this option turned on, after
2858 each such operation the tags are again aligned to `org-tags-column'."
2862 (defcustom org-use-tag-inheritance t
2863 "Non-nil means tags in levels apply also for sublevels.
2864 When nil, only the tags directly given in a specific line apply there.
2865 This may also be a list of tags that should be inherited, or a regexp that
2866 matches tags that should be inherited. Additional control is possible
2867 with the variable `org-tags-exclude-from-inheritance' which gives an
2868 explicit list of tags to be excluded from inheritance., even if the value of
2869 `org-use-tag-inheritance' would select it for inheritance.
2871 If this option is t, a match early-on in a tree can lead to a large
2872 number of matches in the subtree when constructing the agenda or creating
2873 a sparse tree. If you only want to see the first match in a tree during
2874 a search, check out the variable `org-tags-match-list-sublevels'."
2877 (const :tag "Not" nil)
2878 (const :tag "Always" t)
2879 (repeat :tag "Specific tags" (string :tag "Tag"))
2880 (regexp :tag "Tags matched by regexp")))
2882 (defcustom org-tags-exclude-from-inheritance nil
2883 "List of tags that should never be inherited.
2884 This is a way to exclude a few tags from inheritance. For way to do
2885 the opposite, to actively allow inheritance for selected tags,
2886 see the variable `org-use-tag-inheritance'."
2888 :type '(repeat (string :tag "Tag")))
2890 (defun org-tag-inherit-p (tag)
2891 "Check if TAG is one that should be inherited."
2893 ((member tag org-tags-exclude-from-inheritance) nil)
2894 ((eq org-use-tag-inheritance t) t)
2895 ((not org-use-tag-inheritance) nil)
2896 ((stringp org-use-tag-inheritance)
2897 (string-match org-use-tag-inheritance tag))
2898 ((listp org-use-tag-inheritance)
2899 (member tag org-use-tag-inheritance))
2900 (t (error "Invalid setting of `org-use-tag-inheritance'"))))
2902 (defcustom org-tags-match-list-sublevels t
2903 "Non-nil means list also sublevels of headlines matching a search.
2904 This variable applies to tags/property searches, and also to stuck
2905 projects because this search is based on a tags match as well.
2907 When set to the symbol `indented', sublevels are indented with
2910 Because of tag inheritance (see variable `org-use-tag-inheritance'),
2911 the sublevels of a headline matching a tag search often also match
2912 the same search. Listing all of them can create very long lists.
2913 Setting this variable to nil causes subtrees of a match to be skipped.
2915 This variable is semi-obsolete and probably should always be true. It
2916 is better to limit inheritance to certain tags using the variables
2917 `org-use-tag-inheritance' and `org-tags-exclude-from-inheritance'."
2920 (const :tag "No, don't list them" nil)
2921 (const :tag "Yes, do list them" t)
2922 (const :tag "List them, indented with leading dots" indented)))
2924 (defcustom org-tags-sort-function nil
2925 "When set, tags are sorted using this function as a comparator."
2928 (const :tag "No sorting" nil)
2929 (const :tag "Alphabetical" string<)
2930 (const :tag "Reverse alphabetical" string>)
2931 (function :tag "Custom function" nil)))
2933 (defvar org-tags-history nil
2934 "History of minibuffer reads for tags.")
2935 (defvar org-last-tags-completion-table nil
2936 "The last used completion table for tags.")
2937 (defvar org-after-tags-change-hook nil
2938 "Hook that is run after the tags in a line have changed.")
2940 (defgroup org-properties nil
2941 "Options concerning properties in Org-mode."
2942 :tag "Org Properties"
2945 (defcustom org-property-format "%-10s %s"
2946 "How property key/value pairs should be formatted by `indent-line'.
2947 When `indent-line' hits a property definition, it will format the line
2948 according to this format, mainly to make sure that the values are
2949 lined-up with respect to each other."
2950 :group 'org-properties
2953 (defcustom org-use-property-inheritance nil
2954 "Non-nil means properties apply also for sublevels.
2956 This setting is chiefly used during property searches. Turning it on can
2957 cause significant overhead when doing a search, which is why it is not
2960 When nil, only the properties directly given in the current entry count.
2961 When t, every property is inherited. The value may also be a list of
2962 properties that should have inheritance, or a regular expression matching
2963 properties that should be inherited.
2965 However, note that some special properties use inheritance under special
2966 circumstances (not in searches). Examples are CATEGORY, ARCHIVE, COLUMNS,
2967 and the properties ending in \"_ALL\" when they are used as descriptor
2968 for valid values of a property.
2970 Note for programmers:
2971 When querying an entry with `org-entry-get', you can control if inheritance
2972 should be used. By default, `org-entry-get' looks only at the local
2973 properties. You can request inheritance by setting the inherit argument
2974 to t (to force inheritance) or to `selective' (to respect the setting
2976 :group 'org-properties
2978 (const :tag "Not" nil)
2979 (const :tag "Always" t)
2980 (repeat :tag "Specific properties" (string :tag "Property"))
2981 (regexp :tag "Properties matched by regexp")))
2983 (defun org-property-inherit-p (property)
2984 "Check if PROPERTY is one that should be inherited."
2986 ((eq org-use-property-inheritance t) t)
2987 ((not org-use-property-inheritance) nil)
2988 ((stringp org-use-property-inheritance)
2989 (string-match org-use-property-inheritance property))
2990 ((listp org-use-property-inheritance)
2991 (member property org-use-property-inheritance))
2992 (t (error "Invalid setting of `org-use-property-inheritance'"))))
2994 (defcustom org-columns-default-format "%25ITEM %TODO %3PRIORITY %TAGS"
2995 "The default column format, if no other format has been defined.
2996 This variable can be set on the per-file basis by inserting a line
2998 #+COLUMNS: %25ITEM ....."
2999 :group 'org-properties
3002 (defcustom org-columns-ellipses ".."
3003 "The ellipses to be used when a field in column view is truncated.
3004 When this is the empty string, as many characters as possible are shown,
3005 but then there will be no visual indication that the field has been truncated.
3006 When this is a string of length N, the last N characters of a truncated
3007 field are replaced by this string. If the column is narrower than the
3008 ellipses string, only part of the ellipses string will be shown."
3009 :group 'org-properties
3012 (defcustom org-columns-modify-value-for-display-function nil
3013 "Function that modifies values for display in column view.
3014 For example, it can be used to cut out a certain part from a time stamp.
3015 The function must take 2 arguments:
3017 column-title The title of the column (*not* the property name)
3018 value The value that should be modified.
3020 The function should return the value that should be displayed,
3021 or nil if the normal value should be used."
3022 :group 'org-properties
3025 (defcustom org-effort-property "Effort"
3026 "The property that is being used to keep track of effort estimates.
3027 Effort estimates given in this property need to have the format H:MM."
3028 :group 'org-properties
3029 :group 'org-progress
3030 :type '(string :tag "Property"))
3032 (defconst org-global-properties-fixed
3033 '(("VISIBILITY_ALL" . "folded children content all")
3034 ("CLOCK_MODELINE_TOTAL_ALL" . "current today repeat all auto"))
3035 "List of property/value pairs that can be inherited by any entry.
3037 These are fixed values, for the preset properties. The user variable
3038 that can be used to add to this list is `org-global-properties'.
3040 The entries in this list are cons cells where the car is a property
3041 name and cdr is a string with the value. If the value represents
3042 multiple items like an \"_ALL\" property, separate the items by
3045 (defcustom org-global-properties nil
3046 "List of property/value pairs that can be inherited by any entry.
3048 This list will be combined with the constant `org-global-properties-fixed'.
3050 The entries in this list are cons cells where the car is a property
3051 name and cdr is a string with the value.
3053 You can set buffer-local values for the same purpose in the variable
3054 `org-file-properties' this by adding lines like
3056 #+PROPERTY: NAME VALUE"
3057 :group 'org-properties
3059 (cons (string :tag "Property")
3060 (string :tag "Value"))))
3062 (defvar org-file-properties nil
3063 "List of property/value pairs that can be inherited by any entry.
3064 Valid for the current buffer.
3065 This variable is populated from #+PROPERTY lines.")
3066 (make-variable-buffer-local 'org-file-properties)
3068 (defgroup org-agenda nil
3069 "Options concerning agenda views in Org-mode."
3073 (defvar org-category nil
3074 "Variable used by org files to set a category for agenda display.
3075 Such files should use a file variable to set it, for example
3077 # -*- mode: org; org-category: \"ELisp\"
3079 or contain a special line
3083 If the file does not specify a category, then file's base name
3085 (make-variable-buffer-local 'org-category)
3086 (put 'org-category 'safe-local-variable #'(lambda (x) (or (symbolp x) (stringp x))))
3088 (defcustom org-agenda-files nil
3089 "The files to be used for agenda display.
3090 Entries may be added to this list with \\[org-agenda-file-to-front] and removed with
3091 \\[org-remove-file]. You can also use customize to edit the list.
3093 If an entry is a directory, all files in that directory that are matched by
3094 `org-agenda-file-regexp' will be part of the file list.
3096 If the value of the variable is not a list but a single file name, then
3097 the list of agenda files is actually stored and maintained in that file, one
3098 agenda file per line. In this file paths can be given relative to
3099 `org-directory'. Tilde expansion and environment variable substitution
3103 (repeat :tag "List of files and directories" file)
3104 (file :tag "Store list in a file\n" :value "~/.agenda_files")))
3106 (defcustom org-agenda-file-regexp "\\`[^.].*\\.org\\'"
3107 "Regular expression to match files for `org-agenda-files'.
3108 If any element in the list in that variable contains a directory instead
3109 of a normal file, all files in that directory that are matched by this
3110 regular expression will be included."
3114 (defcustom org-agenda-text-search-extra-files nil
3115 "List of extra files to be searched by text search commands.
3116 These files will be search in addition to the agenda files by the
3117 commands `org-search-view' (`C-c a s') and `org-occur-in-agenda-files'.
3118 Note that these files will only be searched for text search commands,
3119 not for the other agenda views like todo lists, tag searches or the weekly
3120 agenda. This variable is intended to list notes and possibly archive files
3121 that should also be searched by these two commands.
3122 In fact, if the first element in the list is the symbol `agenda-archives',
3123 than all archive files of all agenda files will be added to the search
3126 :type '(set :greedy t
3127 (const :tag "Agenda Archives" agenda-archives)
3128 (repeat :inline t (file))))
3130 (if (fboundp 'defvaralias)
3131 (defvaralias 'org-agenda-multi-occur-extra-files
3132 'org-agenda-text-search-extra-files))
3134 (defcustom org-agenda-skip-unavailable-files nil
3135 "Non-nil means to just skip non-reachable files in `org-agenda-files'.
3136 A nil value means to remove them, after a query, from the list."
3140 (defcustom org-calendar-to-agenda-key [?c]
3141 "The key to be installed in `calendar-mode-map' for switching to the agenda.
3142 The command `org-calendar-goto-agenda' will be bound to this key. The
3143 default is the character `c' because then `c' can be used to switch back and
3144 forth between agenda and calendar."
3148 (defcustom org-calendar-agenda-action-key [?k]
3149 "The key to be installed in `calendar-mode-map' for agenda-action.
3150 The command `org-agenda-action' will be bound to this key. The
3151 default is the character `k' because we use the same key in the agenda."
3155 (defcustom org-calendar-insert-diary-entry-key [?i]
3156 "The key to be installed in `calendar-mode-map' for adding diary entries.
3157 This option is irrelevant until `org-agenda-diary-file' has been configured
3158 to point to an Org-mode file. When that is the case, the command
3159 `org-agenda-diary-entry' will be bound to the key given here, by default
3160 `i'. In the calendar, `i' normally adds entries to `diary-file'. So
3161 if you want to continue doing this, you need to change this to a different
3166 (defcustom org-agenda-diary-file 'diary-file
3167 "File to which to add new entries with the `i' key in agenda and calendar.
3168 When this is the symbol `diary-file', the functionality in the Emacs
3169 calendar will be used to add entries to the `diary-file'. But when this
3170 points to a file, `org-agenda-diary-entry' will be used instead."
3173 (const :tag "The standard Emacs diary file" diary-file)
3174 (file :tag "Special Org file diary entries")))
3176 (eval-after-load "calendar"
3178 (org-defkey calendar-mode-map org-calendar-to-agenda-key
3179 'org-calendar-goto-agenda)
3180 (org-defkey calendar-mode-map org-calendar-agenda-action-key
3182 (add-hook 'calendar-mode-hook
3184 (unless (eq org-agenda-diary-file 'diary-file)
3185 (define-key calendar-mode-map
3186 org-calendar-insert-diary-entry-key
3187 'org-agenda-diary-entry))))))
3189 (defgroup org-latex nil
3190 "Options for embedding LaTeX code into Org-mode."
3194 (defcustom org-format-latex-options
3195 '(:foreground default :background default :scale 1.0
3196 :html-foreground "Black" :html-background "Transparent"
3197 :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))
3198 "Options for creating images from LaTeX fragments.
3199 This is a property list with the following properties:
3200 :foreground the foreground color for images embedded in Emacs, e.g. \"Black\".
3201 `default' means use the foreground of the default face.
3202 :background the background color, or \"Transparent\".
3203 `default' means use the background of the default face.
3204 :scale a scaling factor for the size of the images, to get more pixels
3205 :html-foreground, :html-background, :html-scale
3206 the same numbers for HTML export.
3207 :matchers a list indicating which matchers should be used to
3208 find LaTeX fragments. Valid members of this list are:
3209 \"begin\" find environments
3210 \"$1\" find single characters surrounded by $.$
3211 \"$\" find math expressions surrounded by $...$
3212 \"$$\" find math expressions surrounded by $$....$$
3213 \"\\(\" find math expressions surrounded by \\(...\\)
3214 \"\\ [\" find math expressions surrounded by \\ [...\\]"
3218 (defcustom org-format-latex-signal-error t
3219 "Non-nil means signal an error when image creation of LaTeX snippets fails.
3220 When nil, just push out a message."
3224 (defcustom org-format-latex-header "\\documentclass{article}
3225 \\usepackage[usenames]{color}
3226 \\usepackage{amsmath}
3227 \\usepackage[mathscr]{eucal}
3228 \\pagestyle{empty} % do not remove
3231 % The settings below are copied from fullpage.sty
3232 \\setlength{\\textwidth}{\\paperwidth}
3233 \\addtolength{\\textwidth}{-3cm}
3234 \\setlength{\\oddsidemargin}{1.5cm}
3235 \\addtolength{\\oddsidemargin}{-2.54cm}
3236 \\setlength{\\evensidemargin}{\\oddsidemargin}
3237 \\setlength{\\textheight}{\\paperheight}
3238 \\addtolength{\\textheight}{-\\headheight}
3239 \\addtolength{\\textheight}{-\\headsep}
3240 \\addtolength{\\textheight}{-\\footskip}
3241 \\addtolength{\\textheight}{-3cm}
3242 \\setlength{\\topmargin}{1.5cm}
3243 \\addtolength{\\topmargin}{-2.54cm}"
3244 "The document header used for processing LaTeX fragments.
3245 It is imperative that this header make sure that no page number
3246 appears on the page. The package defined in the variables
3247 `org-export-latex-default-packages-alist' and `org-export-latex-packages-alist'
3248 will either replace the placeholder \"[PACKAGES]\" in this header, or they
3253 (defvar org-format-latex-header-extra nil)
3255 (defun org-set-packages-alist (var val)
3256 "Set the packages alist and make sure it has 3 elements per entry."
3257 (set var (mapcar (lambda (x)
3258 (if (and (consp x) (= (length x) 2))
3259 (list (car x) (nth 1 x) t)
3263 (defun org-get-packages-alist (var)
3265 "Get the packages alist and make sure it has 3 elements per entry."
3267 (if (and (consp x) (= (length x) 2))
3268 (list (car x) (nth 1 x) t)
3270 (default-value var)))
3272 ;; The following variables are defined here because is it also used
3273 ;; when formatting latex fragments. Originally it was part of the
3274 ;; LaTeX exporter, which is why the name includes "export".
3275 (defcustom org-export-latex-default-packages-alist
3276 '(("AUTO" "inputenc" t)
3280 ("" "longtable" nil)
3292 "Alist of default packages to be inserted in the header.
3293 Change this only if one of the packages here causes an incompatibility
3294 with another package you are using.
3295 The packages in this list are needed by one part or another of Org-mode
3296 to function properly.
3298 - inputenc, fontenc: for basic font and character selection
3299 - textcomp, marvosymb, wasysym, latexsym, amssym: for various symbols used
3300 for interpreting the entities in `org-entities'. You can skip some of these
3301 packages if you don't use any of the symbols in it.
3302 - graphicx: for including images
3303 - float, wrapfig: for figure placement
3304 - longtable: for long tables
3305 - hyperref: for cross references
3307 Therefore you should not modify this variable unless you know what you
3308 are doing. The one reason to change it anyway is that you might be loading
3309 some other package that conflicts with one of the default packages.
3310 Each cell is of the format \( \"options\" \"package\" snippet-flag\).
3311 If SNIPPET-FLAG is t, the package also needs to be included when
3312 compiling LaTeX snippets into images for inclusion into HTML."
3313 :group 'org-export-latex
3314 :set 'org-set-packages-alist
3315 :get 'org-get-packages-alist
3318 (list :tag "options/package pair"
3319 (string :tag "options")
3320 (string :tag "package")
3321 (boolean :tag "Snippet"))
3322 (string :tag "A line of LaTeX"))))
3324 (defcustom org-export-latex-packages-alist nil
3325 "Alist of packages to be inserted in every LaTeX header.
3326 These will be inserted after `org-export-latex-default-packages-alist'.
3327 Each cell is of the format \( \"options\" \"package\" snippet-flag \).
3328 SNIPPET-FLAG, when t, indicates that this package is also needed when
3329 turning LaTeX snippets into images for inclusion into HTML.
3330 Make sure that you only list packages here which:
3331 - you want in every file
3332 - do not conflict with the default packages in
3333 `org-export-latex-default-packages-alist'
3334 - do not conflict with the setup in `org-format-latex-header'."
3335 :group 'org-export-latex
3336 :set 'org-set-packages-alist
3337 :get 'org-get-packages-alist
3340 (list :tag "options/package pair"
3341 (string :tag "options")
3342 (string :tag "package")
3343 (boolean :tag "Snippet"))
3344 (string :tag "A line of LaTeX"))))
3347 (defgroup org-appearance nil
3348 "Settings for Org-mode appearance."
3349 :tag "Org Appearance"
3352 (defcustom org-level-color-stars-only nil
3353 "Non-nil means fontify only the stars in each headline.
3354 When nil, the entire headline is fontified.
3355 Changing it requires restart of `font-lock-mode' to become effective
3356 also in regions already fontified."
3357 :group 'org-appearance
3360 (defcustom org-hide-leading-stars nil
3361 "Non-nil means hide the first N-1 stars in a headline.
3362 This works by using the face `org-hide' for these stars. This
3363 face is white for a light background, and black for a dark
3364 background. You may have to customize the face `org-hide' to
3366 Changing it requires restart of `font-lock-mode' to become effective
3367 also in regions already fontified.
3368 You may also set this on a per-file basis by adding one of the following
3369 lines to the buffer:
3371 #+STARTUP: hidestars
3372 #+STARTUP: showstars"
3373 :group 'org-appearance
3376 (defcustom org-hidden-keywords nil
3377 "List of symbols corresponding to keywords to be hidden the org buffer.
3378 For example, a value '(title) for this list will make the document's title
3379 appear in the buffer without the initial #+TITLE: keyword."
3380 :group 'org-appearance
3381 :type '(set (const :tag "#+AUTHOR" author)
3382 (const :tag "#+DATE" date)
3383 (const :tag "#+EMAIL" email)
3384 (const :tag "#+TITLE" title)))
3386 (defcustom org-fontify-done-headline nil
3387 "Non-nil means change the face of a headline if it is marked DONE.
3388 Normally, only the TODO/DONE keyword indicates the state of a headline.
3389 When this is non-nil, the headline after the keyword is set to the
3390 `org-headline-done' as an additional indication."
3391 :group 'org-appearance
3394 (defcustom org-fontify-emphasized-text t
3395 "Non-nil means fontify *bold*, /italic/ and _underlined_ text.
3396 Changing this variable requires a restart of Emacs to take effect."
3397 :group 'org-appearance
3400 (defcustom org-fontify-whole-heading-line nil
3401 "Non-nil means fontify the whole line for headings.
3402 This is useful when setting a background color for the
3404 :group 'org-appearance
3407 (defcustom org-highlight-latex-fragments-and-specials nil
3408 "Non-nil means fontify what is treated specially by the exporters."
3409 :group 'org-appearance
3412 (defcustom org-hide-emphasis-markers nil
3413 "Non-nil mean font-lock should hide the emphasis marker characters."
3414 :group 'org-appearance
3417 (defcustom org-pretty-entities nil
3418 "Non-nil means show entities as UTF8 characters.
3419 When nil, the \\name form remains in the buffer."
3420 :group 'org-appearance
3423 (defcustom org-pretty-entities-include-sub-superscripts t
3424 "Non-nil means, pretty entity display includes formatting sub/superscripts."
3425 :group 'org-appearance
3428 (defvar org-emph-re nil
3429 "Regular expression for matching emphasis.
3430 After a match, the match groups contain these elements:
3431 0 The match of the full regular expression, including the characters
3432 before and after the proper match
3433 1 The character before the proper match, or empty at beginning of line
3434 2 The proper match, including the leading and trailing markers
3435 3 The leading marker like * or /, indicating the type of highlighting
3436 4 The text between the emphasis markers, not including the markers
3437 5 The character after the match, empty at the end of a line")
3438 (defvar org-verbatim-re nil
3439 "Regular expression for matching verbatim text.")
3440 (defvar org-emphasis-regexp-components) ; defined just below
3441 (defvar org-emphasis-alist) ; defined just below
3442 (defun org-set-emph-re (var val)
3443 "Set variable and compute the emphasis regular expression."
3445 (when (and (boundp 'org-emphasis-alist)
3446 (boundp 'org-emphasis-regexp-components)
3447 org-emphasis-alist org-emphasis-regexp-components)
3448 (let* ((e org-emphasis-regexp-components)
3454 (body1 (concat body "*?"))
3455 (markers (mapconcat 'car org-emphasis-alist ""))
3456 (vmarkers (mapconcat
3457 (lambda (x) (if (eq (nth 4 x) 'verbatim) (car x) ""))
3458 org-emphasis-alist "")))
3459 ;; make sure special characters appear at the right position in the class
3460 (if (string-match "\\^" markers)
3461 (setq markers (concat (replace-match "" t t markers) "^")))
3462 (if (string-match "-" markers)
3463 (setq markers (concat (replace-match "" t t markers) "-")))
3464 (if (string-match "\\^" vmarkers)
3465 (setq vmarkers (concat (replace-match "" t t vmarkers) "^")))
3466 (if (string-match "-" vmarkers)
3467 (setq vmarkers (concat (replace-match "" t t vmarkers) "-")))
3469 (setq body1 (concat body1 "\\(?:\n" body "*?\\)\\{0,"
3470 (int-to-string nl) "\\}")))
3473 (concat "\\([" pre "]\\|^\\)"
3475 "\\([" markers "]\\)"
3483 "\\([" post "]\\|$\\)"))
3484 (setq org-verbatim-re
3485 (concat "\\([" pre "]\\|^\\)"
3487 "\\([" vmarkers "]\\)"
3495 "\\([" post "]\\|$\\)")))))
3497 (defcustom org-emphasis-regexp-components
3498 '(" \t('\"{" "- \t.,:!?;'\")}\\" " \t\r\n,\"'" "." 1)
3499 "Components used to build the regular expression for emphasis.
3500 This is a list with five entries. Terminology: In an emphasis string
3501 like \" *strong word* \", we call the initial space PREMATCH, the final
3502 space POSTMATCH, the stars MARKERS, \"s\" and \"d\" are BORDER characters
3503 and \"trong wor\" is the body. The different components in this variable
3504 specify what is allowed/forbidden in each part:
3506 pre Chars allowed as prematch. Beginning of line will be allowed too.
3507 post Chars allowed as postmatch. End of line will be allowed too.
3508 border The chars *forbidden* as border characters.
3509 body-regexp A regexp like \".\" to match a body character. Don't use
3510 non-shy groups here, and don't allow newline here.
3511 newline The maximum number of newlines allowed in an emphasis exp.
3513 Use customize to modify this, or restart Emacs after changing it."
3514 :group 'org-appearance
3515 :set 'org-set-emph-re
3517 (sexp :tag "Allowed chars in pre ")
3518 (sexp :tag "Allowed chars in post ")
3519 (sexp :tag "Forbidden chars in border ")
3520 (sexp :tag "Regexp for body ")
3521 (integer :tag "number of newlines allowed")
3522 (option (boolean :tag "Please ignore this button"))))
3524 (defcustom org-emphasis-alist
3525 `(("*" bold "<b>" "</b>")
3526 ("/" italic "<i>" "</i>")
3527 ("_" underline "<span style=\"text-decoration:underline;\">" "</span>")
3528 ("=" org-code "<code>" "</code>" verbatim)
3529 ("~" org-verbatim "<code>" "</code>" verbatim)
3530 ("+" ,(if (featurep 'xemacs) 'org-table '(:strike-through t))
3533 "Special syntax for emphasized text.
3534 Text starting and ending with a special character will be emphasized, for
3535 example *bold*, _underlined_ and /italic/. This variable sets the marker
3536 characters, the face to be used by font-lock for highlighting in Org-mode
3537 Emacs buffers, and the HTML tags to be used for this.
3538 For LaTeX export, see the variable `org-export-latex-emphasis-alist'.
3539 For DocBook export, see the variable `org-export-docbook-emphasis-alist'.
3540 Use customize to modify this, or restart Emacs after changing it."
3541 :group 'org-appearance
3542 :set 'org-set-emph-re
3545 (string :tag "Marker character")
3547 (face :tag "Font-lock-face")
3548 (plist :tag "Face property list"))
3549 (string :tag "HTML start tag")
3550 (string :tag "HTML end tag")
3551 (option (const verbatim)))))
3553 (defvar org-protecting-blocks
3554 '("src" "example" "latex" "ascii" "html" "docbook" "ditaa" "dot" "r" "R")
3555 "Blocks that contain text that is quoted, i.e. not processed as Org syntax.
3556 This is needed for font-lock setup.")
3558 ;;; Miscellaneous options
3560 (defgroup org-completion nil
3561 "Completion in Org-mode."
3562 :tag "Org Completion"
3565 (defcustom org-completion-use-ido nil
3566 "Non-nil means use ido completion wherever possible.
3567 Note that `ido-mode' must be active for this variable to be relevant.
3568 If you decide to turn this variable on, you might well want to turn off
3569 `org-outline-path-complete-in-steps'.
3570 See also `org-completion-use-iswitchb'."
3571 :group 'org-completion
3574 (defcustom org-completion-use-iswitchb nil
3575 "Non-nil means use iswitchb completion wherever possible.
3576 Note that `iswitchb-mode' must be active for this variable to be relevant.
3577 If you decide to turn this variable on, you might well want to turn off
3578 `org-outline-path-complete-in-steps'.
3579 Note that this variable has only an effect if `org-completion-use-ido' is nil."
3580 :group 'org-completion
3583 (defcustom org-completion-fallback-command 'hippie-expand
3584 "The expansion command called by \\[pcomplete] in normal context.
3585 Normal means, no org-mode-specific context."
3586 :group 'org-completion
3589 ;;; Functions and variables from their packages
3590 ;; Declared here to avoid compiler warnings
3593 (defvar outline-mode-menu-heading)
3594 (defvar outline-mode-menu-show)
3595 (defvar outline-mode-menu-hide)
3596 (defvar zmacs-regions) ; XEmacs regions
3599 (defvar mark-active)
3602 (declare-function calendar-absolute-from-iso "cal-iso" (date))
3603 (declare-function calendar-forward-day "cal-move" (arg))
3604 (declare-function calendar-goto-date "cal-move" (date))
3605 (declare-function calendar-goto-today "cal-move" ())
3606 (declare-function calendar-iso-from-absolute "cal-iso" (date))
3607 (defvar calc-embedded-close-formula)
3608 (defvar calc-embedded-open-formula)
3609 (declare-function cdlatex-tab "ext:cdlatex" ())
3610 (declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep))
3611 (defvar font-lock-unfontify-region-function)
3612 (declare-function iswitchb-read-buffer "iswitchb"
3613 (prompt &optional default require-match start matches-set))
3614 (defvar iswitchb-temp-buflist)
3615 (declare-function org-gnus-follow-link "org-gnus" (&optional group article))
3616 (defvar org-agenda-tags-todo-honor-ignore-options)
3617 (declare-function org-agenda-skip "org-agenda" ())
3619 org-format-agenda-item "org-agenda"
3620 (extra txt &optional category tags dotime noprefix remove-re habitp))
3621 (declare-function org-agenda-new-marker "org-agenda" (&optional pos))
3622 (declare-function org-agenda-change-all-lines "org-agenda"
3623 (newhead hdmarker &optional fixface just-this))
3624 (declare-function org-agenda-set-restriction-lock "org-agenda" (&optional type))
3625 (declare-function org-agenda-maybe-redo "org-agenda" ())
3626 (declare-function org-agenda-save-markers-for-cut-and-paste "org-agenda"
3628 (declare-function org-agenda-copy-local-variable "org-agenda" (var))
3629 (declare-function org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item
3630 "org-agenda" (&optional end))
3631 (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())