Merge branch 'maint'
[org-mode.git] / lisp / org.el
1 ;;; org.el --- Outline-based notes management and organizer
3 ;; Carstens outline-mode for keeping track of everything.
4 ;; Copyright (C) 2004-2012 Free Software Foundation, Inc.
5 ;;
6 ;; Author: Carsten Dominik <carsten at orgmode dot org>
7 ;; Maintainer: Bastien Guerry <bzg at gnu dot org>
8 ;; Keywords: outlines, hypermedia, calendar, wp
9 ;; Homepage:
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
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 <>.
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
27 ;;; Commentary:
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
45 ;; linked webpages.
47 ;; Installation and Activation
48 ;; ---------------------------
49 ;; See the corresponding sections in the manual at
51 ;;
53 ;; Documentation
54 ;; -------------
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 ;;
64 ;;; Code:
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
73 (eval-when-compile
74 (require 'cl)
75 (require 'gnus-sum))
77 (require 'calendar)
78 (require 'find-func)
79 (require 'format-spec)
81 (let ((load-suffixes (list ".el")))
82 (load "org-loaddefs" 'noerror nil nil 'mustsuffix))
84 ;; `org-outline-regexp' ought to be a defconst but is let-binding in
85 ;; some places -- e.g. see the macro org-with-limited-levels.
87 ;; In Org buffers, the value of `outline-regexp' is that of
88 ;; `org-outline-regexp'. The only function still directly relying on
89 ;; `outline-regexp' is `org-overview' so that `org-cycle' can do its
90 ;; job when `orgstruct-mode' is active.
91 (defvar org-outline-regexp "\\*+ "
92 "Regexp to match Org headlines.")
94 (defvar org-outline-regexp-bol "^\\*+ "
95 "Regexp to match Org headlines.
96 This is similar to `org-outline-regexp' but additionally makes
97 sure that we are at the beginning of the line.")
99 (defvar org-heading-regexp "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
100 "Matches an headline, putting stars and text into groups.
101 Stars are put in group 1 and the trimmed body in group 2.")
103 ;; Emacs 22 calendar compatibility: Make sure the new variables are available
104 (when (fboundp 'defvaralias)
105 (unless (boundp 'calendar-view-holidays-initially-flag)
106 (defvaralias 'calendar-view-holidays-initially-flag
107 'view-calendar-holidays-initially))
108 (unless (boundp 'calendar-view-diary-initially-flag)
109 (defvaralias 'calendar-view-diary-initially-flag
110 'view-diary-entries-initially))
111 (unless (boundp 'diary-fancy-buffer)
112 (defvaralias 'diary-fancy-buffer 'fancy-diary-buffer)))
114 (declare-function org-inlinetask-at-task-p "org-inlinetask" ())
115 (declare-function org-inlinetask-outline-regexp "org-inlinetask" ())
116 (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ())
117 (declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label))
118 (declare-function org-at-clock-log-p "org-clock" ())
119 (declare-function org-clock-get-last-clock-out-time "org-clock" ())
120 (declare-function org-clock-timestamps-up "org-clock" (&optional n))
121 (declare-function org-clock-timestamps-down "org-clock" (&optional n))
122 (declare-function org-clock-sum-current-item "org-clock" (&optional tstart))
124 (declare-function orgtbl-mode "org-table" (&optional arg))
125 (declare-function org-clock-out "org-clock" (&optional switch-to-state fail-quietly at-time))
126 (declare-function org-beamer-mode "org-beamer" ())
127 (declare-function org-table-edit-field "org-table" (arg))
128 (declare-function org-table-justify-field-maybe "org-table" (&optional new))
129 (declare-function org-id-get-create "org-id" (&optional force))
130 (declare-function org-id-find-id-file "org-id" (id))
131 (declare-function org-tags-view "org-agenda" (&optional todo-only match))
132 (declare-function org-agenda-list "org-agenda" (&optional arg start-day span))
133 (declare-function org-table-align "org-table" ())
134 (declare-function org-table-paste-rectangle "org-table" ())
135 (declare-function org-table-maybe-eval-formula "org-table" ())
136 (declare-function org-table-maybe-recalculate-line "org-table" ())
138 (autoload 'org-element-at-point "org-element")
139 (autoload 'org-element-type "org-element")
141 (declare-function org-element-at-point "org-element" (&optional keep-trail))
142 (declare-function org-element-type "org-element" (element))
143 (declare-function org-element-context "org-element" ())
144 (declare-function org-element-contents "org-element" (element))
145 (declare-function org-element-property "org-element" (property element))
146 (declare-function org-element-map "org-element" (data types fun &optional info first-match no-recursion))
147 (declare-function org-element-nested-p "org-element" (elem-a elem-b))
148 (declare-function org-element-swap-A-B "org-element" (elem-a elem-b))
149 (declare-function org-element--parse-objects "org-element" (beg end acc restriction))
150 (declare-function org-element-parse-buffer "org-element" (&optional granularity visible-only))
152 ;; load languages based on value of `org-babel-load-languages'
153 (defvar org-babel-load-languages)
155 ;;;###autoload
156 (defun org-babel-do-load-languages (sym value)
157 "Load the languages defined in `org-babel-load-languages'."
158 (set-default sym value)
159 (mapc (lambda (pair)
160 (let ((active (cdr pair)) (lang (symbol-name (car pair))))
161 (if active
162 (progn
163 (require (intern (concat "ob-" lang))))
164 (progn
165 (funcall 'fmakunbound
166 (intern (concat "org-babel-execute:" lang)))
167 (funcall 'fmakunbound
168 (intern (concat "org-babel-expand-body:" lang)))))))
169 org-babel-load-languages))
171 (defcustom org-babel-load-languages '((emacs-lisp . t))
172 "Languages which can be evaluated in Org-mode buffers.
173 This list can be used to load support for any of the languages
174 below, note that each language will depend on a different set of
175 system executables and/or Emacs modes. When a language is
176 \"loaded\", then code blocks in that language can be evaluated
177 with `org-babel-execute-src-block' bound by default to C-c
178 C-c (note the `org-babel-no-eval-on-ctrl-c-ctrl-c' variable can
179 be set to remove code block evaluation from the C-c C-c
180 keybinding. By default only Emacs Lisp (which has no
181 requirements) is loaded."
182 :group 'org-babel
183 :set 'org-babel-do-load-languages
184 :version "24.1"
185 :type '(alist :tag "Babel Languages"
186 :key-type
187 (choice
188 (const :tag "Awk" awk)
189 (const :tag "C" C)
190 (const :tag "R" R)
191 (const :tag "Asymptote" asymptote)
192 (const :tag "Calc" calc)
193 (const :tag "Clojure" clojure)
194 (const :tag "CSS" css)
195 (const :tag "Ditaa" ditaa)
196 (const :tag "Dot" dot)
197 (const :tag "Emacs Lisp" emacs-lisp)
198 (const :tag "Fortran" fortran)
199 (const :tag "Gnuplot" gnuplot)
200 (const :tag "Haskell" haskell)
201 (const :tag "IO" io)
202 (const :tag "Java" java)
203 (const :tag "Javascript" js)
204 (const :tag "LaTeX" latex)
205 (const :tag "Ledger" ledger)
206 (const :tag "Lilypond" lilypond)
207 (const :tag "Lisp" lisp)
208 (const :tag "Makefile" makefile)
209 (const :tag "Maxima" maxima)
210 (const :tag "Matlab" matlab)
211 (const :tag "Mscgen" mscgen)
212 (const :tag "Ocaml" ocaml)
213 (const :tag "Octave" octave)
214 (const :tag "Org" org)
215 (const :tag "Perl" perl)
216 (const :tag "Pico Lisp" picolisp)
217 (const :tag "PlantUML" plantuml)
218 (const :tag "Python" python)
219 (const :tag "Ruby" ruby)
220 (const :tag "Sass" sass)
221 (const :tag "Scala" scala)
222 (const :tag "Scheme" scheme)
223 (const :tag "Screen" screen)
224 (const :tag "Shell Script" sh)
225 (const :tag "Shen" shen)
226 (const :tag "Sql" sql)
227 (const :tag "Sqlite" sqlite))
228 :value-type (boolean :tag "Activate" :value t)))
230 ;;;; Customization variables
231 (defcustom org-clone-delete-id nil
232 "Remove ID property of clones of a subtree.
233 When non-nil, clones of a subtree don't inherit the ID property.
234 Otherwise they inherit the ID property with a new unique
235 identifier."
236 :type 'boolean
237 :version "24.1"
238 :group 'org-id)
240 ;;; Version
241 (require 'org-compat)
242 (org-check-version)
244 ;;;###autoload
245 (defun org-version (&optional here full message)
246 "Show the org-mode version in the echo area.
247 With prefix argument HERE, insert it at point.
248 When FULL is non-nil, use a verbose version string.
249 When MESSAGE is non-nil, display a message with the version."
250 (interactive "P")
251 (let* ((org-dir (ignore-errors (org-find-library-dir "org")))
252 (save-load-suffixes load-suffixes)
253 (load-suffixes (list ".el"))
254 (org-install-dir (ignore-errors (org-find-library-dir "org-loaddefs")))
255 (org-trash (or
256 (and (fboundp 'org-release) (fboundp 'org-git-version))
257 (load (concat org-dir "org-version")
258 'noerror 'nomessage nil 'mustsuffix)))
259 (load-suffixes save-load-suffixes)
260 (org-version (org-release))
261 (git-version (org-git-version))
262 (version (format "Org-mode version %s (%s @ %s)"
263 org-version
264 git-version
265 (if org-install-dir
266 (if (string= org-dir org-install-dir)
267 org-install-dir
268 (concat "mixed installation! " org-install-dir " and " org-dir))
269 "org-loaddefs.el can not be found!")))
270 (_version (if full version org-version)))
271 (if (org-called-interactively-p 'interactive)
272 (if here
273 (insert version)
274 (message version))
275 (if message (message _version))
276 _version)))
278 (defconst org-version (org-version))
280 ;;; Compatibility constants
282 ;;; The custom variables
284 (defgroup org nil
285 "Outline-based notes management and organizer."
286 :tag "Org"
287 :group 'outlines
288 :group 'calendar)
290 (defcustom org-mode-hook nil
291 "Mode hook for Org-mode, run after the mode was turned on."
292 :group 'org
293 :type 'hook)
295 (defcustom org-load-hook nil
296 "Hook that is run after org.el has been loaded."
297 :group 'org
298 :type 'hook)
300 (defcustom org-log-buffer-setup-hook nil
301 "Hook that is run after an Org log buffer is created."
302 :group 'org
303 :version "24.1"
304 :type 'hook)
306 (defvar org-modules) ; defined below
307 (defvar org-modules-loaded nil
308 "Have the modules been loaded already?")
310 (defun org-load-modules-maybe (&optional force)
311 "Load all extensions listed in `org-modules'."
312 (when (or force (not org-modules-loaded))
313 (mapc (lambda (ext)
314 (condition-case nil (require ext)
315 (error (message "Problems while trying to load feature `%s'" ext))))
316 org-modules)
317 (setq org-modules-loaded t)))
319 (defun org-set-modules (var value)
320 "Set VAR to VALUE and call `org-load-modules-maybe' with the force flag."
321 (set var value)
322 (when (featurep 'org)
323 (org-load-modules-maybe 'force)))
325 (when (org-bound-and-true-p org-modules)
326 (let ((a (member 'org-infojs org-modules)))
327 (and a (setcar a 'org-jsinfo))))
329 (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)
330 "Modules that should always be loaded together with org.el.
331 If a description starts with <C>, the file is not part of Emacs
332 and loading it will require that you have downloaded and properly installed
333 the org-mode distribution.
335 You can also use this system to load external packages (i.e. neither Org
336 core modules, nor modules from the CONTRIB directory). Just add symbols
337 to the end of the list. If the package is called org-xyz.el, then you need
338 to add the symbol `xyz', and the package must have a call to
340 (provide 'org-xyz)"
341 :group 'org
342 :set 'org-set-modules
343 :type
344 '(set :greedy t
345 (const :tag " bbdb: Links to BBDB entries" org-bbdb)
346 (const :tag " bibtex: Links to BibTeX entries" org-bibtex)
347 (const :tag " crypt: Encryption of subtrees" org-crypt)
348 (const :tag " ctags: Access to Emacs tags with links" org-ctags)
349 (const :tag " docview: Links to doc-view buffers" org-docview)
350 (const :tag " gnus: Links to GNUS folders/messages" org-gnus)
351 (const :tag " id: Global IDs for identifying entries" org-id)
352 (const :tag " info: Links to Info nodes" org-info)
353 (const :tag " jsinfo: Set up Sebastian Rose's JavaScript org-info.js" org-jsinfo)
354 (const :tag " habit: Track your consistency with habits" org-habit)
355 (const :tag " inlinetask: Tasks independent of outline hierarchy" org-inlinetask)
356 (const :tag " irc: Links to IRC/ERC chat sessions" org-irc)
357 (const :tag " mac-message: Links to messages in Apple Mail" org-mac-message)
358 (const :tag " mew Links to Mew folders/messages" org-mew)
359 (const :tag " mhe: Links to MHE folders/messages" org-mhe)
360 (const :tag " protocol: Intercept calls from emacsclient" org-protocol)
361 (const :tag " rmail: Links to RMAIL folders/messages" org-rmail)
362 (const :tag " special-blocks: Turn blocks into LaTeX envs and HTML divs" org-special-blocks)
363 (const :tag " vm: Links to VM folders/messages" org-vm)
364 (const :tag " wl: Links to Wanderlust folders/messages" org-wl)
365 (const :tag " w3m: Special cut/paste from w3m to Org-mode." org-w3m)
366 (const :tag " mouse: Additional mouse support" org-mouse)
367 (const :tag " TaskJuggler: Export tasks to a TaskJuggler project" org-taskjuggler)
369 (const :tag "C annotate-file: Annotate a file with org syntax" org-annotate-file)
370 (const :tag "C bookmark: Org-mode links to bookmarks" org-bookmark)
371 (const :tag "C checklist: Extra functions for checklists in repeated tasks" org-checklist)
372 (const :tag "C choose: Use TODO keywords to mark decisions states" org-choose)
373 (const :tag "C collector: Collect properties into tables" org-collector)
374 (const :tag "C depend: TODO dependencies for Org-mode\n\t\t\t(PARTIALLY OBSOLETE, see built-in dependency support))" org-depend)
375 (const :tag "C drill: Flashcards and spaced repetition for Org-mode" org-drill)
376 (const :tag "C elisp-symbol: Org-mode links to emacs-lisp symbols" org-elisp-symbol)
377 (const :tag "C eshell Support for links to working directories in eshell" org-eshell)
378 (const :tag "C eval: Include command output as text" org-eval)
379 (const :tag "C eval-light: Evaluate inbuffer-code on demand" org-eval-light)
380 (const :tag "C expiry: Expiry mechanism for Org-mode entries" org-expiry)
381 (const :tag "C exp-bibtex: Export citations using BibTeX" org-exp-bibtex)
382 (const :tag "C git-link: Provide org links to specific file version" org-git-link)
383 (const :tag "C interactive-query: Interactive modification of tags query\n\t\t\t(PARTIALLY OBSOLETE, see secondary filtering)" org-interactive-query)
385 (const :tag "C invoice: Help manage client invoices in Org-mode" org-invoice)
387 (const :tag "C jira: Add a jira:ticket protocol to Org-mode" org-jira)
388 (const :tag "C learn: SuperMemo's incremental learning algorithm" org-learn)
389 (const :tag "C mairix: Hook mairix search into Org-mode for different MUAs" org-mairix)
390 (const :tag "C notmuch: Provide org links to notmuch searches or messages" org-notmuch)
391 (const :tag "C mac-iCal Imports events from to the Emacs diary" org-mac-iCal)
392 (const :tag "C mac-link-grabber Grab links and URLs from various Mac applications" org-mac-link-grabber)
393 (const :tag "C man: Support for links to manpages in Org-mode" org-man)
394 (const :tag "C mtags: Support for muse-like tags" org-mtags)
395 (const :tag "C panel: Simple routines for us with bad memory" org-panel)
396 (const :tag "C registry: A registry for Org-mode links" org-registry)
397 (const :tag "C org2rem: Convert org appointments into reminders" org2rem)
398 (const :tag "C screen: Visit screen sessions through Org-mode links" org-screen)
399 (const :tag "C secretary: Team management with org-mode" org-secretary)
400 (const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert)
401 (const :tag "C toc: Table of contents for Org-mode buffer" org-toc)
402 (const :tag "C track: Keep up with Org-mode development" org-track)
403 (const :tag "C velocity Something like Notational Velocity for Org" org-velocity)
404 (const :tag "C wikinodes: CamelCase wiki-like links" org-wikinodes)
405 (repeat :tag "External packages" :inline t (symbol :tag "Package"))))
407 (defcustom org-support-shift-select nil
408 "Non-nil means make shift-cursor commands select text when possible.
410 In Emacs 23, when `shift-select-mode' is on, shifted cursor keys
411 start selecting a region, or enlarge regions started in this way.
412 In Org-mode, in special contexts, these same keys are used for
413 other purposes, important enough to compete with shift selection.
414 Org tries to balance these needs by supporting `shift-select-mode'
415 outside these special contexts, under control of this variable.
417 The default of this variable is nil, to avoid confusing behavior. Shifted
418 cursor keys will then execute Org commands in the following contexts:
419 - on a headline, changing TODO state (left/right) and priority (up/down)
420 - on a time stamp, changing the time
421 - in a plain list item, changing the bullet type
422 - in a property definition line, switching between allowed values
423 - in the BEGIN line of a clock table (changing the time block).
424 Outside these contexts, the commands will throw an error.
426 When this variable is t and the cursor is not in a special
427 context, Org-mode will support shift-selection for making and
428 enlarging regions. To make this more effective, the bullet
429 cycling will no longer happen anywhere in an item line, but only
430 if the cursor is exactly on the bullet.
432 If you set this variable to the symbol `always', then the keys
433 will not be special in headlines, property lines, and item lines,
434 to make shift selection work there as well. If this is what you
435 want, you can use the following alternative commands: `C-c C-t'
436 and `C-c ,' to change TODO state and priority, `C-u C-u C-c C-t'
437 can be used to switch TODO sets, `C-c -' to cycle item bullet
438 types, and properties can be edited by hand or in column view.
440 However, when the cursor is on a timestamp, shift-cursor commands
441 will still edit the time stamp - this is just too good to give up.
443 XEmacs user should have this variable set to nil, because
444 `shift-select-mode' is in Emacs 23 or later only."
445 :group 'org
446 :type '(choice
447 (const :tag "Never" nil)
448 (const :tag "When outside special context" t)
449 (const :tag "Everywhere except timestamps" always)))
451 (defcustom org-loop-over-headlines-in-active-region nil
452 "Shall some commands act upon headlines in the active region?
454 When set to `t', some commands will be performed in all headlines
455 within the active region.
457 When set to `start-level', some commands will be performed in all
458 headlines within the active region, provided that these headlines
459 are of the same level than the first one.
461 When set to a string, those commands will be performed on the
462 matching headlines within the active region. Such string must be
463 a tags/property/todo match as it is used in the agenda tags view.
465 The list of commands is: `org-schedule', `org-deadline',
466 `org-todo', `org-archive-subtree', `org-archive-set-tag' and
467 `org-archive-to-archive-sibling'. The archiving commands skip
468 already archived entries."
469 :type '(choice (const :tag "Don't loop" nil)
470 (const :tag "All headlines in active region" t)
471 (const :tag "In active region, headlines at the same level than the first one" 'start-level)
472 (string :tag "Tags/Property/Todo matcher"))
473 :version "24.1"
474 :group 'org-todo
475 :group 'org-archive)
477 (defgroup org-startup nil
478 "Options concerning startup of Org-mode."
479 :tag "Org Startup"
480 :group 'org)
482 (defcustom org-startup-folded t
483 "Non-nil means entering Org-mode will switch to OVERVIEW.
484 This can also be configured on a per-file basis by adding one of
485 the following lines anywhere in the buffer:
487 #+STARTUP: fold (or `overview', this is equivalent)
488 #+STARTUP: nofold (or `showall', this is equivalent)
489 #+STARTUP: content
490 #+STARTUP: showeverything"
491 :group 'org-startup
492 :type '(choice
493 (const :tag "nofold: show all" nil)
494 (const :tag "fold: overview" t)
495 (const :tag "content: all headlines" content)
496 (const :tag "show everything, even drawers" showeverything)))
498 (defcustom org-startup-truncated t
499 "Non-nil means entering Org-mode will set `truncate-lines'.
500 This is useful since some lines containing links can be very long and
501 uninteresting. Also tables look terrible when wrapped."
502 :group 'org-startup
503 :type 'boolean)
505 (defcustom org-startup-indented nil
506 "Non-nil means turn on `org-indent-mode' on startup.
507 This can also be configured on a per-file basis by adding one of
508 the following lines anywhere in the buffer:
510 #+STARTUP: indent
511 #+STARTUP: noindent"
512 :group 'org-structure
513 :type '(choice
514 (const :tag "Not" nil)
515 (const :tag "Globally (slow on startup in large files)" t)))
517 (defcustom org-use-sub-superscripts t
518 "Non-nil means interpret \"_\" and \"^\" for export.
519 When this option is turned on, you can use TeX-like syntax for sub- and
520 superscripts. Several characters after \"_\" or \"^\" will be
521 considered as a single item - so grouping with {} is normally not
522 needed. For example, the following things will be parsed as single
523 sub- or superscripts.
525 10^24 or 10^tau several digits will be considered 1 item.
526 10^-12 or 10^-tau a leading sign with digits or a word
527 x^2-y^3 will be read as x^2 - y^3, because items are
528 terminated by almost any nonword/nondigit char.
529 x_{i^2} or x^(2-i) braces or parenthesis do grouping.
531 Still, ambiguity is possible - so when in doubt use {} to enclose the
532 sub/superscript. If you set this variable to the symbol `{}',
533 the braces are *required* in order to trigger interpretations as
534 sub/superscript. This can be helpful in documents that need \"_\"
535 frequently in plain text.
537 Not all export backends support this, but HTML does.
539 This option can also be set with the #+OPTIONS line, e.g. \"^:nil\"."
540 :group 'org-startup
541 :group 'org-export-translation
542 :version "24.1"
543 :type '(choice
544 (const :tag "Always interpret" t)
545 (const :tag "Only with braces" {})
546 (const :tag "Never interpret" nil)))
548 (if (fboundp 'defvaralias)
549 (defvaralias 'org-export-with-sub-superscripts 'org-use-sub-superscripts))
552 (defcustom org-startup-with-beamer-mode nil
553 "Non-nil means turn on `org-beamer-mode' on startup.
554 This can also be configured on a per-file basis by adding one of
555 the following lines anywhere in the buffer:
557 #+STARTUP: beamer"
558 :group 'org-startup
559 :version "24.1"
560 :type 'boolean)
562 (defcustom org-startup-align-all-tables nil
563 "Non-nil means align all tables when visiting a file.
564 This is useful when the column width in tables is forced with <N> cookies
565 in table fields. Such tables will look correct only after the first re-align.
566 This can also be configured on a per-file basis by adding one of
567 the following lines anywhere in the buffer:
568 #+STARTUP: align
569 #+STARTUP: noalign"
570 :group 'org-startup
571 :type 'boolean)
573 (defcustom org-startup-with-inline-images nil
574 "Non-nil means show inline images when loading a new Org file.
575 This can also be configured on a per-file basis by adding one of
576 the following lines anywhere in the buffer:
577 #+STARTUP: inlineimages
578 #+STARTUP: noinlineimages"
579 :group 'org-startup
580 :version "24.1"
581 :type 'boolean)
583 (defcustom org-insert-mode-line-in-empty-file nil
584 "Non-nil means insert the first line setting Org-mode in empty files.
585 When the function `org-mode' is called interactively in an empty file, this
586 normally means that the file name does not automatically trigger Org-mode.
587 To ensure that the file will always be in Org-mode in the future, a
588 line enforcing Org-mode will be inserted into the buffer, if this option
589 has been set."
590 :group 'org-startup
591 :type 'boolean)
593 (defcustom org-replace-disputed-keys nil
594 "Non-nil means use alternative key bindings for some keys.
595 Org-mode uses S-<cursor> keys for changing timestamps and priorities.
596 These keys are also used by other packages like shift-selection-mode'
597 \(built into Emacs 23), `CUA-mode' or `windmove.el'.
598 If you want to use Org-mode together with one of these other modes,
599 or more generally if you would like to move some Org-mode commands to
600 other keys, set this variable and configure the keys with the variable
601 `org-disputed-keys'.
603 This option is only relevant at load-time of Org-mode, and must be set
604 *before* org.el is loaded. Changing it requires a restart of Emacs to
605 become effective."
606 :group 'org-startup
607 :type 'boolean)
609 (defcustom org-use-extra-keys nil
610 "Non-nil means use extra key sequence definitions for certain commands.
611 This happens automatically if you run XEmacs or if `window-system'
612 is nil. This variable lets you do the same manually. You must
613 set it before loading org.
615 Example: on Carbon Emacs 22 running graphically, with an external
616 keyboard on a Powerbook, the default way of setting M-left might
617 not work for either Alt or ESC. Setting this variable will make
618 it work for ESC."
619 :group 'org-startup
620 :type 'boolean)
622 (if (fboundp 'defvaralias)
623 (defvaralias 'org-CUA-compatible 'org-replace-disputed-keys))
625 (defcustom org-disputed-keys
626 '(([(shift up)] . [(meta p)])
627 ([(shift down)] . [(meta n)])
628 ([(shift left)] . [(meta -)])
629 ([(shift right)] . [(meta +)])
630 ([(control shift right)] . [(meta shift +)])
631 ([(control shift left)] . [(meta shift -)]))
632 "Keys for which Org-mode and other modes compete.
633 This is an alist, cars are the default keys, second element specifies
634 the alternative to use when `org-replace-disputed-keys' is t.
636 Keys can be specified in any syntax supported by `define-key'.
637 The value of this option takes effect only at Org-mode's startup,
638 therefore you'll have to restart Emacs to apply it after changing."
639 :group 'org-startup
640 :type 'alist)
642 (defun org-key (key)
643 "Select key according to `org-replace-disputed-keys' and `org-disputed-keys'.
644 Or return the original if not disputed.
645 Also apply the translations defined in `org-xemacs-key-equivalents'."
646 (when org-replace-disputed-keys
647 (let* ((nkey (key-description key))
648 (x (org-find-if (lambda (x)
649 (equal (key-description (car x)) nkey))
650 org-disputed-keys)))
651 (setq key (if x (cdr x) key))))
652 (when (featurep 'xemacs)
653 (setq key (or (cdr (assoc key org-xemacs-key-equivalents)) key)))
654 key)
656 (defun org-find-if (predicate seq)
657 (catch 'exit
658 (while seq
659 (if (funcall predicate (car seq))
660 (throw 'exit (car seq))
661 (pop seq)))))
663 (defun org-defkey (keymap key def)
664 "Define a key, possibly translated, as returned by `org-key'."
665 (define-key keymap (org-key key) def))
667 (defcustom org-ellipsis nil
668 "The ellipsis to use in the Org-mode outline.
669 When nil, just use the standard three dots. When a string, use that instead,
670 When a face, use the standard 3 dots, but with the specified face.
671 The change affects only Org-mode (which will then use its own display table).
672 Changing this requires executing `M-x org-mode' in a buffer to become
673 effective."
674 :group 'org-startup
675 :type '(choice (const :tag "Default" nil)
676 (face :tag "Face" :value org-warning)
677 (string :tag "String" :value "...#")))
679 (defvar org-display-table nil
680 "The display table for org-mode, in case `org-ellipsis' is non-nil.")
682 (defgroup org-keywords nil
683 "Keywords in Org-mode."
684 :tag "Org Keywords"
685 :group 'org)
687 (defcustom org-deadline-string "DEADLINE:"
688 "String to mark deadline entries.
689 A deadline is this string, followed by a time stamp. Should be a word,
690 terminated by a colon. You can insert a schedule keyword and
691 a timestamp with \\[org-deadline].
692 Changes become only effective after restarting Emacs."
693 :group 'org-keywords
694 :type 'string)
696 (defcustom org-scheduled-string "SCHEDULED:"
697 "String to mark scheduled TODO entries.
698 A schedule is this string, followed by a time stamp. Should be a word,
699 terminated by a colon. You can insert a schedule keyword and
700 a timestamp with \\[org-schedule].
701 Changes become only effective after restarting Emacs."
702 :group 'org-keywords
703 :type 'string)
705 (defcustom org-closed-string "CLOSED:"
706 "String used as the prefix for timestamps logging closing a TODO entry."
707 :group 'org-keywords
708 :type 'string)
710 (defcustom org-clock-string "CLOCK:"
711 "String used as prefix for timestamps clocking work hours on an item."
712 :group 'org-keywords
713 :type 'string)
715 (defconst org-planning-or-clock-line-re (concat "^[ \t]*\\("
716 org-scheduled-string "\\|"
717 org-deadline-string "\\|"
718 org-closed-string "\\|"
719 org-clock-string "\\)")
720 "Matches a line with planning or clock info.")
722 (defcustom org-comment-string "COMMENT"
723 "Entries starting with this keyword will never be exported.
724 An entry can be toggled between COMMENT and normal with
725 \\[org-toggle-comment].
726 Changes become only effective after restarting Emacs."
727 :group 'org-keywords
728 :type 'string)
730 (defcustom org-quote-string "QUOTE"
731 "Entries starting with this keyword will be exported in fixed-width font.
732 Quoting applies only to the text in the entry following the headline, and does
733 not extend beyond the next headline, even if that is lower level.
734 An entry can be toggled between QUOTE and normal with
735 \\[org-toggle-fixed-width-section]."
736 :group 'org-keywords
737 :type 'string)
739 (defconst org-repeat-re
740 "<[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^>\n]*?\\([.+]?\\+[0-9]+[hdwmy]\\(/[0-9]+[hdwmy]\\)?\\)"
741 "Regular expression for specifying repeated events.
742 After a match, group 1 contains the repeat expression.")
744 (defgroup org-structure nil
745 "Options concerning the general structure of Org-mode files."
746 :tag "Org Structure"
747 :group 'org)
749 (defgroup org-reveal-location nil
750 "Options about how to make context of a location visible."
751 :tag "Org Reveal Location"
752 :group 'org-structure)
754 (defconst org-context-choice
755 '(choice
756 (const :tag "Always" t)
757 (const :tag "Never" nil)
758 (repeat :greedy t :tag "Individual contexts"
759 (cons
760 (choice :tag "Context"
761 (const agenda)
762 (const org-goto)
763 (const occur-tree)
764 (const tags-tree)
765 (const link-search)
766 (const mark-goto)
767 (const bookmark-jump)
768 (const isearch)
769 (const default))
770 (boolean))))
771 "Contexts for the reveal options.")
773 (defcustom org-show-hierarchy-above '((default . t))
774 "Non-nil means show full hierarchy when revealing a location.
775 Org-mode often shows locations in an org-mode file which might have
776 been invisible before. When this is set, the hierarchy of headings
777 above the exposed location is shown.
778 Turning this off for example for sparse trees makes them very compact.
779 Instead of t, this can also be an alist specifying this option for different
780 contexts. Valid contexts are
781 agenda when exposing an entry from the agenda
782 org-goto when using the command `org-goto' on key C-c C-j
783 occur-tree when using the command `org-occur' on key C-c /
784 tags-tree when constructing a sparse tree based on tags matches
785 link-search when exposing search matches associated with a link
786 mark-goto when exposing the jump goal of a mark
787 bookmark-jump when exposing a bookmark location
788 isearch when exiting from an incremental search
789 default default for all contexts not set explicitly"
790 :group 'org-reveal-location
791 :type org-context-choice)
793 (defcustom org-show-following-heading '((default . nil))
794 "Non-nil means show following heading when revealing a location.
795 Org-mode often shows locations in an org-mode file which might have
796 been invisible before. When this is set, the heading following the
797 match is shown.
798 Turning this off for example for sparse trees makes them very compact,
799 but makes it harder to edit the location of the match. In such a case,
800 use the command \\[org-reveal] to show more context.
801 Instead of t, this can also be an alist specifying this option for different
802 contexts. See `org-show-hierarchy-above' for valid contexts."
803 :group 'org-reveal-location
804 :type org-context-choice)
806 (defcustom org-show-siblings '((default . nil) (isearch t))
807 "Non-nil means show all sibling heading when revealing a location.
808 Org-mode often shows locations in an org-mode file which might have
809 been invisible before. When this is set, the sibling of the current entry
810 heading are all made visible. If `org-show-hierarchy-above' is t,
811 the same happens on each level of the hierarchy above the current entry.
813 By default this is on for the isearch context, off for all other contexts.
814 Turning this off for example for sparse trees makes them very compact,
815 but makes it harder to edit the location of the match. In such a case,
816 use the command \\[org-reveal] to show more context.
817 Instead of t, this can also be an alist specifying this option for different
818 contexts. See `org-show-hierarchy-above' for valid contexts."
819 :group 'org-reveal-location
820 :type org-context-choice)
822 (defcustom org-show-entry-below '((default . nil))
823 "Non-nil means show the entry below a headline when revealing a location.
824 Org-mode often shows locations in an org-mode file which might have
825 been invisible before. When this is set, the text below the headline that is
826 exposed is also shown.
828 By default this is off for all contexts.
829 Instead of t, this can also be an alist specifying this option for different
830 contexts. See `org-show-hierarchy-above' for valid contexts."
831 :group 'org-reveal-location
832 :type org-context-choice)
834 (defcustom org-indirect-buffer-display 'other-window
835 "How should indirect tree buffers be displayed?
836 This applies to indirect buffers created with the commands
837 \\[org-tree-to-indirect-buffer] and \\[org-agenda-tree-to-indirect-buffer].
838 Valid values are:
839 current-window Display in the current window
840 other-window Just display in another window.
841 dedicated-frame Create one new frame, and re-use it each time.
842 new-frame Make a new frame each time. Note that in this case
843 previously-made indirect buffers are kept, and you need to
844 kill these buffers yourself."
845 :group 'org-structure
846 :group 'org-agenda-windows
847 :type '(choice
848 (const :tag "In current window" current-window)
849 (const :tag "In current frame, other window" other-window)
850 (const :tag "Each time a new frame" new-frame)
851 (const :tag "One dedicated frame" dedicated-frame)))
853 (defcustom org-use-speed-commands nil
854 "Non-nil means activate single letter commands at beginning of a headline.
855 This may also be a function to test for appropriate locations where speed
856 commands should be active."
857 :group 'org-structure
858 :type '(choice
859 (const :tag "Never" nil)
860 (const :tag "At beginning of headline stars" t)
861 (function)))
863 (defcustom org-speed-commands-user nil
864 "Alist of additional speed commands.
865 This list will be checked before `org-speed-commands-default'
866 when the variable `org-use-speed-commands' is non-nil
867 and when the cursor is at the beginning of a headline.
868 The car if each entry is a string with a single letter, which must
869 be assigned to `self-insert-command' in the global map.
870 The cdr is either a command to be called interactively, a function
871 to be called, or a form to be evaluated.
872 An entry that is just a list with a single string will be interpreted
873 as a descriptive headline that will be added when listing the speed
874 commands in the Help buffer using the `?' speed command."
875 :group 'org-structure
876 :type '(repeat :value ("k" . ignore)
877 (choice :value ("k" . ignore)
878 (list :tag "Descriptive Headline" (string :tag "Headline"))
879 (cons :tag "Letter and Command"
880 (string :tag "Command letter")
881 (choice
882 (function)
883 (sexp))))))
885 (defgroup org-cycle nil
886 "Options concerning visibility cycling in Org-mode."
887 :tag "Org Cycle"
888 :group 'org-structure)
890 (defcustom org-cycle-skip-children-state-if-no-children t
891 "Non-nil means skip CHILDREN state in entries that don't have any."
892 :group 'org-cycle
893 :type 'boolean)
895 (defcustom org-cycle-max-level nil
896 "Maximum level which should still be subject to visibility cycling.
897 Levels higher than this will, for cycling, be treated as text, not a headline.
898 When `org-odd-levels-only' is set, a value of N in this variable actually
899 means 2N-1 stars as the limiting headline.
900 When nil, cycle all levels.
901 Note that the limiting level of cycling is also influenced by
902 `org-inlinetask-min-level'. When `org-cycle-max-level' is not set but
903 `org-inlinetask-min-level' is, cycling will be limited to levels one less
904 than its value."
905 :group 'org-cycle
906 :type '(choice
907 (const :tag "No limit" nil)
908 (integer :tag "Maximum level")))
910 (defcustom org-drawers '("PROPERTIES" "CLOCK" "LOGBOOK" "RESULTS")
911 "Names of drawers. Drawers are not opened by cycling on the headline above.
912 Drawers only open with a TAB on the drawer line itself. A drawer looks like
913 this:
915 .....
916 :END:
917 The drawer \"PROPERTIES\" is special for capturing properties through
918 the property API.
920 Drawers can be defined on the per-file basis with a line like:
923 :group 'org-structure
924 :group 'org-cycle
925 :type '(repeat (string :tag "Drawer Name")))
927 (defcustom org-hide-block-startup nil
928 "Non-nil means entering Org-mode will fold all blocks.
929 This can also be set in on a per-file basis with
931 #+STARTUP: hideblocks
932 #+STARTUP: showblocks"
933 :group 'org-startup
934 :group 'org-cycle
935 :type 'boolean)
937 (defcustom org-cycle-global-at-bob nil
938 "Cycle globally if cursor is at beginning of buffer and not at a headline.
939 This makes it possible to do global cycling without having to use S-TAB or
940 \\[universal-argument] TAB. For this special case to work, the first line
941 of the buffer must not be a headline -- it may be empty or some other text.
942 When used in this way, `org-cycle-hook' is disabled temporarily to make
943 sure the cursor stays at the beginning of the buffer. When this option is
944 nil, don't do anything special at the beginning of the buffer."
945 :group 'org-cycle
946 :type 'boolean)
948 (defcustom org-cycle-level-after-item/entry-creation t
949 "Non-nil means cycle entry level or item indentation in new empty entries.
951 When the cursor is at the end of an empty headline, i.e with only stars
952 and maybe a TODO keyword, TAB will then switch the entry to become a child,
953 and then all possible ancestor states, before returning to the original state.
954 This makes data entry extremely fast: M-RET to create a new headline,
955 on TAB to make it a child, two or more tabs to make it a (grand-)uncle.
957 When the cursor is at the end of an empty plain list item, one TAB will
958 make it a subitem, two or more tabs will back up to make this an item
959 higher up in the item hierarchy."
960 :group 'org-cycle
961 :type 'boolean)
963 (defcustom org-cycle-emulate-tab t
964 "Where should `org-cycle' emulate TAB.
965 nil Never
966 white Only in completely white lines
967 whitestart Only at the beginning of lines, before the first non-white char
968 t Everywhere except in headlines
969 exc-hl-bol Everywhere except at the start of a headline
970 If TAB is used in a place where it does not emulate TAB, the current subtree
971 visibility is cycled."
972 :group 'org-cycle
973 :type '(choice (const :tag "Never" nil)
974 (const :tag "Only in completely white lines" white)
975 (const :tag "Before first char in a line" whitestart)
976 (const :tag "Everywhere except in headlines" t)
977 (const :tag "Everywhere except at bol in headlines" exc-hl-bol)
980 (defcustom org-cycle-separator-lines 2
981 "Number of empty lines needed to keep an empty line between collapsed trees.
982 If you leave an empty line between the end of a subtree and the following
983 headline, this empty line is hidden when the subtree is folded.
984 Org-mode will leave (exactly) one empty line visible if the number of
985 empty lines is equal or larger to the number given in this variable.
986 So the default 2 means at least 2 empty lines after the end of a subtree
987 are needed to produce free space between a collapsed subtree and the
988 following headline.
990 If the number is negative, and the number of empty lines is at least -N,
991 all empty lines are shown.
993 Special case: when 0, never leave empty lines in collapsed view."
994 :group 'org-cycle
995 :type 'integer)
996 (put 'org-cycle-separator-lines 'safe-local-variable 'integerp)
998 (defcustom org-pre-cycle-hook nil
999 "Hook that is run before visibility cycling is happening.
1000 The function(s) in this hook must accept a single argument which indicates
1001 the new state that will be set right after running this hook. The
1002 argument is a symbol. Before a global state change, it can have the values
1003 `overview', `content', or `all'. Before a local state change, it can have
1004 the values `folded', `children', or `subtree'."
1005 :group 'org-cycle
1006 :type 'hook)
1008 (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees
1009 org-cycle-hide-drawers
1010 org-cycle-hide-inline-tasks
1011 org-cycle-show-empty-lines
1012 org-optimize-window-after-visibility-change)
1013 "Hook that is run after `org-cycle' has changed the buffer visibility.
1014 The function(s) in this hook must accept a single argument which indicates
1015 the new state that was set by the most recent `org-cycle' command. The
1016 argument is a symbol. After a global state change, it can have the values
1017 `overview', `contents', or `all'. After a local state change, it can have
1018 the values `folded', `children', or `subtree'."
1019 :group 'org-cycle
1020 :type 'hook)
1022 (defgroup org-edit-structure nil
1023 "Options concerning structure editing in Org-mode."
1024 :tag "Org Edit Structure"
1025 :group 'org-structure)
1027 (defcustom org-odd-levels-only nil
1028 "Non-nil means skip even levels and only use odd levels for the outline.
1029 This has the effect that two stars are being added/taken away in
1030 promotion/demotion commands. It also influences how levels are
1031 handled by the exporters.
1032 Changing it requires restart of `font-lock-mode' to become effective
1033 for fontification also in regions already fontified.
1034 You may also set this on a per-file basis by adding one of the following
1035 lines to the buffer:
1037 #+STARTUP: odd
1038 #+STARTUP: oddeven"
1039 :group 'org-edit-structure
1040 :group 'org-appearance
1041 :type 'boolean)
1043 (defcustom org-adapt-indentation t
1044 "Non-nil means adapt indentation to outline node level.
1046 When this variable is set, Org assumes that you write outlines by
1047 indenting text in each node to align with the headline (after the stars).
1048 The following issues are influenced by this variable:
1050 - When this is set and the *entire* text in an entry is indented, the
1051 indentation is increased by one space in a demotion command, and
1052 decreased by one in a promotion command. If any line in the entry
1053 body starts with text at column 0, indentation is not changed at all.
1055 - Property drawers and planning information is inserted indented when
1056 this variable s set. When nil, they will not be indented.
1058 - TAB indents a line relative to context. The lines below a headline
1059 will be indented when this variable is set.
1061 Note that this is all about true indentation, by adding and removing
1062 space characters. See also `org-indent.el' which does level-dependent
1063 indentation in a virtual way, i.e. at display time in Emacs."
1064 :group 'org-edit-structure
1065 :type 'boolean)
1067 (defcustom org-special-ctrl-a/e nil
1068 "Non-nil means `C-a' and `C-e' behave specially in headlines and items.
1070 When t, `C-a' will bring back the cursor to the beginning of the
1071 headline text, i.e. after the stars and after a possible TODO
1072 keyword. In an item, this will be the position after bullet and
1073 check-box, if any. When the cursor is already at that position,
1074 another `C-a' will bring it to the beginning of the line.
1076 `C-e' will jump to the end of the headline, ignoring the presence
1077 of tags in the headline. A second `C-e' will then jump to the
1078 true end of the line, after any tags. This also means that, when
1079 this variable is non-nil, `C-e' also will never jump beyond the
1080 end of the heading of a folded section, i.e. not after the
1081 ellipses.
1083 When set to the symbol `reversed', the first `C-a' or `C-e' works
1084 normally, going to the true line boundary first. Only a directly
1085 following, identical keypress will bring the cursor to the
1086 special positions.
1088 This may also be a cons cell where the behavior for `C-a' and
1089 `C-e' is set separately."
1090 :group 'org-edit-structure
1091 :type '(choice
1092 (const :tag "off" nil)
1093 (const :tag "on: after stars/bullet and before tags first" t)
1094 (const :tag "reversed: true line boundary first" reversed)
1095 (cons :tag "Set C-a and C-e separately"
1096 (choice :tag "Special C-a"
1097 (const :tag "off" nil)
1098 (const :tag "on: after stars/bullet first" t)
1099 (const :tag "reversed: before stars/bullet first" reversed))
1100 (choice :tag "Special C-e"
1101 (const :tag "off" nil)
1102 (const :tag "on: before tags first" t)
1103 (const :tag "reversed: after tags first" reversed)))))
1104 (if (fboundp 'defvaralias)
1105 (defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e))
1107 (defcustom org-special-ctrl-k nil
1108 "Non-nil means `C-k' will behave specially in headlines.
1109 When nil, `C-k' will call the default `kill-line' command.
1110 When t, the following will happen while the cursor is in the headline:
1112 - When the cursor is at the beginning of a headline, kill the entire
1113 line and possible the folded subtree below the line.
1114 - When in the middle of the headline text, kill the headline up to the tags.
1115 - When after the headline text, kill the tags."
1116 :group 'org-edit-structure
1117 :type 'boolean)
1119 (defcustom org-ctrl-k-protect-subtree nil
1120 "Non-nil means, do not delete a hidden subtree with C-k.
1121 When set to the symbol `error', simply throw an error when C-k is
1122 used to kill (part-of) a headline that has hidden text behind it.
1123 Any other non-nil value will result in a query to the user, if it is
1124 OK to kill that hidden subtree. When nil, kill without remorse."
1125 :group 'org-edit-structure
1126 :version "24.1"
1127 :type '(choice
1128 (const :tag "Do not protect hidden subtrees" nil)
1129 (const :tag "Protect hidden subtrees with a security query" t)
1130 (const :tag "Never kill a hidden subtree with C-k" error)))
1132 (defcustom org-catch-invisible-edits nil
1133 "Check if in invisible region before inserting or deleting a character.
1134 Valid values are:
1136 nil Do not check, so just do invisible edits.
1137 error Throw an error and do nothing.
1138 show Make point visible, and do the requested edit.
1139 show-and-error Make point visible, then throw an error and abort the edit.
1140 smart Make point visible, and do insertion/deletion if it is
1141 adjacent to visible text and the change feels predictable.
1142 Never delete a previously invisible character or add in the
1143 middle or right after an invisible region. Basically, this
1144 allows insertion and backward-delete right before ellipses.
1145 FIXME: maybe in this case we should not even show?"
1146 :group 'org-edit-structure
1147 :version "24.1"
1148 :type '(choice
1149 (const :tag "Do not check" nil)
1150 (const :tag "Throw error when trying to edit" error)
1151 (const :tag "Unhide, but do not do the edit" show-and-error)
1152 (const :tag "Show invisible part and do the edit" show)
1153 (const :tag "Be smart and do the right thing" smart)))
1155 (defcustom org-yank-folded-subtrees t
1156 "Non-nil means when yanking subtrees, fold them.
1157 If the kill is a single subtree, or a sequence of subtrees, i.e. if
1158 it starts with a heading and all other headings in it are either children
1159 or siblings, then fold all the subtrees. However, do this only if no
1160 text after the yank would be swallowed into a folded tree by this action."
1161 :group 'org-edit-structure
1162 :type 'boolean)
1164 (defcustom org-yank-adjusted-subtrees nil
1165 "Non-nil means when yanking subtrees, adjust the level.
1166 With this setting, `org-paste-subtree' is used to insert the subtree, see
1167 this function for details."
1168 :group 'org-edit-structure
1169 :type 'boolean)
1171 (defcustom org-M-RET-may-split-line '((default . t))
1172 "Non-nil means M-RET will split the line at the cursor position.
1173 When nil, it will go to the end of the line before making a
1174 new line.
1175 You may also set this option in a different way for different
1176 contexts. Valid contexts are:
1178 headline when creating a new headline
1179 item when creating a new item
1180 table in a table field
1181 default the value to be used for all contexts not explicitly
1182 customized"
1183 :group 'org-structure
1184 :group 'org-table
1185 :type '(choice
1186 (const :tag "Always" t)
1187 (const :tag "Never" nil)
1188 (repeat :greedy t :tag "Individual contexts"
1189 (cons
1190 (choice :tag "Context"
1191 (const headline)
1192 (const item)
1193 (const table)
1194 (const default))
1195 (boolean)))))
1198 (defcustom org-insert-heading-respect-content nil
1199 "Non-nil means insert new headings after the current subtree.
1200 When nil, the new heading is created directly after the current line.
1201 The commands \\[org-insert-heading-respect-content] and
1202 \\[org-insert-todo-heading-respect-content] turn this variable on
1203 for the duration of the command."
1204 :group 'org-structure
1205 :type 'boolean)
1207 (defcustom org-blank-before-new-entry '((heading . auto)
1208 (plain-list-item . auto))
1209 "Should `org-insert-heading' leave a blank line before new heading/item?
1210 The value is an alist, with `heading' and `plain-list-item' as CAR,
1211 and a boolean flag as CDR. The cdr may also be the symbol `auto', in
1212 which case Org will look at the surrounding headings/items and try to
1213 make an intelligent decision whether to insert a blank line or not.
1215 For plain lists, if the variable `org-empty-line-terminates-plain-lists' is
1216 set, the setting here is ignored and no empty line is inserted, to avoid
1217 breaking the list structure."
1218 :group 'org-edit-structure
1219 :type '(list
1220 (cons (const heading)
1221 (choice (const :tag "Never" nil)
1222 (const :tag "Always" t)
1223 (const :tag "Auto" auto)))
1224 (cons (const plain-list-item)
1225 (choice (const :tag "Never" nil)
1226 (const :tag "Always" t)
1227 (const :tag "Auto" auto)))))
1229 (defcustom org-insert-heading-hook nil
1230 "Hook being run after inserting a new heading."
1231 :group 'org-edit-structure
1232 :type 'hook)
1234 (defcustom org-enable-fixed-width-editor t
1235 "Non-nil means lines starting with \":\" are treated as fixed-width.
1236 This currently only means they are never auto-wrapped.
1237 When nil, such lines will be treated like ordinary lines.
1238 See also the QUOTE keyword."
1239 :group 'org-edit-structure
1240 :type 'boolean)
1242 (defcustom org-goto-auto-isearch t
1243 "Non-nil means typing characters in `org-goto' starts incremental search."
1244 :group 'org-edit-structure
1245 :type 'boolean)
1247 (defgroup org-sparse-trees nil
1248 "Options concerning sparse trees in Org-mode."
1249 :tag "Org Sparse Trees"
1250 :group 'org-structure)
1252 (defcustom org-highlight-sparse-tree-matches t
1253 "Non-nil means highlight all matches that define a sparse tree.
1254 The highlights will automatically disappear the next time the buffer is
1255 changed by an edit command."
1256 :group 'org-sparse-trees
1257 :type 'boolean)
1259 (defcustom org-remove-highlights-with-change t
1260 "Non-nil means any change to the buffer will remove temporary highlights.
1261 Such highlights are created by `org-occur' and `org-clock-display'.
1262 When nil, `C-c C-c needs to be used to get rid of the highlights.
1263 The highlights created by `org-preview-latex-fragment' always need
1264 `C-c C-c' to be removed."
1265 :group 'org-sparse-trees
1266 :group 'org-time
1267 :type 'boolean)
1270 (defcustom org-occur-hook '(org-first-headline-recenter)
1271 "Hook that is run after `org-occur' has constructed a sparse tree.
1272 This can be used to recenter the window to show as much of the structure
1273 as possible."
1274 :group 'org-sparse-trees
1275 :type 'hook)
1277 (defgroup org-imenu-and-speedbar nil
1278 "Options concerning imenu and speedbar in Org-mode."
1279 :tag "Org Imenu and Speedbar"
1280 :group 'org-structure)
1282 (defcustom org-imenu-depth 2
1283 "The maximum level for Imenu access to Org-mode headlines.
1284 This also applied for speedbar access."
1285 :group 'org-imenu-and-speedbar
1286 :type 'integer)
1288 (defgroup org-table nil
1289 "Options concerning tables in Org-mode."
1290 :tag "Org Table"
1291 :group 'org)
1293 (defcustom org-enable-table-editor 'optimized
1294 "Non-nil means lines starting with \"|\" are handled by the table editor.
1295 When nil, such lines will be treated like ordinary lines.
1297 When equal to the symbol `optimized', the table editor will be optimized to
1298 do the following:
1299 - Automatic overwrite mode in front of whitespace in table fields.
1300 This makes the structure of the table stay in tact as long as the edited
1301 field does not exceed the column width.
1302 - Minimize the number of realigns. Normally, the table is aligned each time
1303 TAB or RET are pressed to move to another field. With optimization this
1304 happens only if changes to a field might have changed the column width.
1305 Optimization requires replacing the functions `self-insert-command',
1306 `delete-char', and `backward-delete-char' in Org-mode buffers, with a
1307 slight (in fact: unnoticeable) speed impact for normal typing. Org-mode is
1308 very good at guessing when a re-align will be necessary, but you can always
1309 force one with \\[org-ctrl-c-ctrl-c].
1311 If you would like to use the optimized version in Org-mode, but the
1312 un-optimized version in OrgTbl-mode, see the variable `orgtbl-optimized'.
1314 This variable can be used to turn on and off the table editor during a session,
1315 but in order to toggle optimization, a restart is required.
1317 See also the variable `org-table-auto-blank-field'."
1318 :group 'org-table
1319 :type '(choice
1320 (const :tag "off" nil)
1321 (const :tag "on" t)
1322 (const :tag "on, optimized" optimized)))
1324 (defcustom org-self-insert-cluster-for-undo (or (featurep 'xemacs)
1325 (version<= emacs-version "24.1"))
1326 "Non-nil means cluster self-insert commands for undo when possible.
1327 If this is set, then, like in the Emacs command loop, 20 consecutive
1328 characters will be undone together.
1329 This is configurable, because there is some impact on typing performance."
1330 :group 'org-table
1331 :type 'boolean)
1333 (defcustom org-table-tab-recognizes-table.el t
1334 "Non-nil means TAB will automatically notice a table.el table.
1335 When it sees such a table, it moves point into it and - if necessary -
1336 calls `table-recognize-table'."
1337 :group 'org-table-editing
1338 :type 'boolean)
1340 (defgroup org-link nil
1341 "Options concerning links in Org-mode."
1342 :tag "Org Link"
1343 :group 'org)
1345 (defvar org-link-abbrev-alist-local nil
1346 "Buffer-local version of `org-link-abbrev-alist', which see.
1347 The value of this is taken from the #+LINK lines.")
1348 (make-variable-buffer-local 'org-link-abbrev-alist-local)
1350 (defcustom org-link-abbrev-alist nil
1351 "Alist of link abbreviations.
1352 The car of each element is a string, to be replaced at the start of a link.
1353 The cdrs are replacement values, like (\"linkkey\" . REPLACE). Abbreviated
1354 links in Org-mode buffers can have an optional tag after a double colon, e.g.
1356 [[linkkey:tag][description]]
1358 The 'linkkey' must be a word word, starting with a letter, followed
1359 by letters, numbers, '-' or '_'.
1361 If REPLACE is a string, the tag will simply be appended to create the link.
1362 If the string contains \"%s\", the tag will be inserted there. If the string
1363 contains \"%h\", it will cause a url-encoded version of the tag to be inserted
1364 at that point (see the function `url-hexify-string'). If the string contains
1365 the specifier \"%(my-function)\", then the custom function `my-function' will
1366 be invoked: this function takes the tag as its only argument and must return
1367 a string.
1369 REPLACE may also be a function that will be called with the tag as the
1370 only argument to create the link, which should be returned as a string.
1372 See the manual for examples."
1373 :group 'org-link
1374 :type '(repeat
1375 (cons
1376 (string :tag "Protocol")
1377 (choice
1378 (string :tag "Format")
1379 (function)))))
1381 (defcustom org-descriptive-links t
1382 "Non-nil means Org will display descriptive links.
1383 E.g. [[][Org website]] will be displayed as
1384 \"Org Website\", hiding the link itself and just displaying its
1385 description. When set to `nil', Org will display the full links
1386 literally.
1388 You can interactively set the value of this variable by calling
1389 `org-toggle-link-display' or from the menu Org>Hyperlinks menu."
1390 :group 'org-link
1391 :type 'boolean)
1393 (defcustom org-link-file-path-type 'adaptive
1394 "How the path name in file links should be stored.
1395 Valid values are:
1397 relative Relative to the current directory, i.e. the directory of the file
1398 into which the link is being inserted.
1399 absolute Absolute path, if possible with ~ for home directory.
1400 noabbrev Absolute path, no abbreviation of home directory.
1401 adaptive Use relative path for files in the current directory and sub-
1402 directories of it. For other files, use an absolute path."
1403 :group 'org-link
1404 :type '(choice
1405 (const relative)
1406 (const absolute)
1407 (const noabbrev)
1408 (const adaptive)))
1410 (defcustom org-activate-links '(bracket angle plain radio tag date footnote)
1411 "Types of links that should be activated in Org-mode files.
1412 This is a list of symbols, each leading to the activation of a certain link
1413 type. In principle, it does not hurt to turn on most link types - there may
1414 be a small gain when turning off unused link types. The types are:
1416 bracket The recommended [[link][description]] or [[link]] links with hiding.
1417 angle Links in angular brackets that may contain whitespace like
1418 <bbdb:Carsten Dominik>.
1419 plain Plain links in normal text, no whitespace, like
1420 radio Text that is matched by a radio target, see manual for details.
1421 tag Tag settings in a headline (link to tag search).
1422 date Time stamps (link to calendar).
1423 footnote Footnote labels.
1425 Changing this variable requires a restart of Emacs to become effective."
1426 :group 'org-link
1427 :type '(set :greedy t
1428 (const :tag "Double bracket links" bracket)
1429 (const :tag "Angular bracket links" angle)
1430 (const :tag "Plain text links" plain)
1431 (const :tag "Radio target matches" radio)
1432 (const :tag "Tags" tag)
1433 (const :tag "Timestamps" date)
1434 (const :tag "Footnotes" footnote)))
1436 (defcustom org-make-link-description-function nil
1437 "Function to use for generating link descriptions from links.
1438 When nil, the link location will be used. This function must take
1439 two parameters: the first one is the link, the second one is the
1440 description generated by `org-insert-link'. The function should
1441 return the description to use."
1442 :group 'org-link
1443 :type 'function)
1445 (defgroup org-link-store nil
1446 "Options concerning storing links in Org-mode."
1447 :tag "Org Store Link"
1448 :group 'org-link)
1450 (defcustom org-url-hexify-p t
1451 "When non-nil, hexify URL when creating a link."
1452 :type 'boolean
1453 :version "24.3"
1454 :group 'org-link-store)
1456 (defcustom org-email-link-description-format "Email %c: %.30s"
1457 "Format of the description part of a link to an email or usenet message.
1458 The following %-escapes will be replaced by corresponding information:
1460 %F full \"From\" field
1461 %f name, taken from \"From\" field, address if no name
1462 %T full \"To\" field
1463 %t first name in \"To\" field, address if no name
1464 %c correspondent. Usually \"from NAME\", but if you sent it yourself, it
1465 will be \"to NAME\". See also the variable `org-from-is-user-regexp'.
1466 %s subject
1467 %d date
1468 %m message-id.
1470 You may use normal field width specification between the % and the letter.
1471 This is for example useful to limit the length of the subject.
1473 Examples: \"%f on: %.30s\", \"Email from %f\", \"Email %c\""
1474 :group 'org-link-store
1475 :type 'string)
1477 (defcustom org-from-is-user-regexp
1478 (let (r1 r2)
1479 (when (and user-mail-address (not (string= user-mail-address "")))
1480 (setq r1 (concat "\\<" (regexp-quote user-mail-address) "\\>")))
1481 (when (and user-full-name (not (string= user-full-name "")))
1482 (setq r2 (concat "\\<" (regexp-quote user-full-name) "\\>")))
1483 (if (and r1 r2) (concat r1 "\\|" r2) (or r1 r2)))
1484 "Regexp matched against the \"From:\" header of an email or usenet message.
1485 It should match if the message is from the user him/herself."
1486 :group 'org-link-store
1487 :type 'regexp)
1489 (defcustom org-context-in-file-links t
1490 "Non-nil means file links from `org-store-link' contain context.
1491 A search string will be added to the file name with :: as separator and
1492 used to find the context when the link is activated by the command
1493 `org-open-at-point'. When this option is t, the entire active region
1494 will be placed in the search string of the file link. If set to a
1495 positive integer, only the first n lines of context will be stored.
1497 Using a prefix arg to the command \\[org-store-link] (`org-store-link')
1498 negates this setting for the duration of the command."
1499 :group 'org-link-store
1500 :type '(choice boolean integer))
1502 (defcustom org-keep-stored-link-after-insertion nil
1503 "Non-nil means keep link in list for entire session.
1505 The command `org-store-link' adds a link pointing to the current
1506 location to an internal list. These links accumulate during a session.
1507 The command `org-insert-link' can be used to insert links into any
1508 Org-mode file (offering completion for all stored links). When this
1509 option is nil, every link which has been inserted once using \\[org-insert-link]
1510 will be removed from the list, to make completing the unused links
1511 more efficient."
1512 :group 'org-link-store
1513 :type 'boolean)
1515 (defgroup org-link-follow nil
1516 "Options concerning following links in Org-mode."
1517 :tag "Org Follow Link"
1518 :group 'org-link)
1520 (defcustom org-link-translation-function nil
1521 "Function to translate links with different syntax to Org syntax.
1522 This can be used to translate links created for example by the Planner
1523 or emacs-wiki packages to Org syntax.
1524 The function must accept two parameters, a TYPE containing the link
1525 protocol name like \"rmail\" or \"gnus\" as a string, and the linked path,
1526 which is everything after the link protocol. It should return a cons
1527 with possibly modified values of type and path.
1528 Org contains a function for this, so if you set this variable to
1529 `org-translate-link-from-planner', you should be able follow many
1530 links created by planner."
1531 :group 'org-link-follow
1532 :type 'function)
1534 (defcustom org-follow-link-hook nil
1535 "Hook that is run after a link has been followed."
1536 :group 'org-link-follow
1537 :type 'hook)
1539 (defcustom org-tab-follows-link nil
1540 "Non-nil means on links TAB will follow the link.
1541 Needs to be set before org.el is loaded.
1542 This really should not be used, it does not make sense, and the
1543 implementation is bad."
1544 :group 'org-link-follow
1545 :type 'boolean)
1547 (defcustom org-return-follows-link nil
1548 "Non-nil means on links RET will follow the link."
1549 :group 'org-link-follow
1550 :type 'boolean)
1552 (defcustom org-mouse-1-follows-link
1553 (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t)
1554 "Non-nil means mouse-1 on a link will follow the link.
1555 A longer mouse click will still set point. Does not work on XEmacs.
1556 Needs to be set before org.el is loaded."
1557 :group 'org-link-follow
1558 :type 'boolean)
1560 (defcustom org-mark-ring-length 4
1561 "Number of different positions to be recorded in the ring.
1562 Changing this requires a restart of Emacs to work correctly."
1563 :group 'org-link-follow
1564 :type 'integer)
1566 (defcustom org-link-search-must-match-exact-headline 'query-to-create
1567 "Non-nil means internal links in Org files must exactly match a headline.
1568 When nil, the link search tries to match a phrase with all words
1569 in the search text."
1570 :group 'org-link-follow
1571 :version "24.1"
1572 :type '(choice
1573 (const :tag "Use fuzzy text search" nil)
1574 (const :tag "Match only exact headline" t)
1575 (const :tag "Match exact headline or query to create it"
1576 query-to-create)))
1578 (defcustom org-link-frame-setup
1579 '((vm . vm-visit-folder-other-frame)
1580 (vm-imap . vm-visit-imap-folder-other-frame)
1581 (gnus . org-gnus-no-new-news)
1582 (file . find-file-other-window)
1583 (wl . wl-other-frame))
1584 "Setup the frame configuration for following links.
1585 When following a link with Emacs, it may often be useful to display
1586 this link in another window or frame. This variable can be used to
1587 set this up for the different types of links.
1588 For VM, use any of
1589 `vm-visit-folder'
1590 `vm-visit-folder-other-window'
1591 `vm-visit-folder-other-frame'
1592 For Gnus, use any of
1593 `gnus'
1594 `gnus-other-frame'
1595 `org-gnus-no-new-news'
1596 For FILE, use any of
1597 `find-file'
1598 `find-file-other-window'
1599 `find-file-other-frame'
1600 For Wanderlust use any of
1601 `wl'
1602 `wl-other-frame'
1603 For the calendar, use the variable `calendar-setup'.
1604 For BBDB, it is currently only possible to display the matches in
1605 another window."
1606 :group 'org-link-follow
1607 :type '(list
1608 (cons (const vm)
1609 (choice
1610 (const vm-visit-folder)
1611 (const vm-visit-folder-other-window)
1612 (const vm-visit-folder-other-frame)))
1613 (cons (const gnus)
1614 (choice
1615 (const gnus)
1616 (const gnus-other-frame)
1617 (const org-gnus-no-new-news)))
1618 (cons (const file)
1619 (choice
1620 (const find-file)
1621 (const find-file-other-window)
1622 (const find-file-other-frame)))
1623 (cons (const wl)
1624 (choice
1625 (const wl)
1626 (const wl-other-frame)))))
1628 (defcustom org-display-internal-link-with-indirect-buffer nil
1629 "Non-nil means use indirect buffer to display infile links.
1630 Activating internal links (from one location in a file to another location
1631 in the same file) normally just jumps to the location. When the link is
1632 activated with a \\[universal-argument] prefix (or with mouse-3), the link \
1633 is displayed in
1634 another window. When this option is set, the other window actually displays
1635 an indirect buffer clone of the current buffer, to avoid any visibility
1636 changes to the current buffer."
1637 :group 'org-link-follow
1638 :type 'boolean)
1640 (defcustom org-open-non-existing-files nil
1641 "Non-nil means `org-open-file' will open non-existing files.
1642 When nil, an error will be generated.
1643 This variable applies only to external applications because they
1644 might choke on non-existing files. If the link is to a file that
1645 will be opened in Emacs, the variable is ignored."
1646 :group 'org-link-follow
1647 :type 'boolean)
1649 (defcustom org-open-directory-means-index-dot-org nil
1650 "Non-nil means a link to a directory really means to
1651 When nil, following a directory link will run dired or open a finder/explorer
1652 window on that directory."
1653 :group 'org-link-follow
1654 :type 'boolean)
1656 (defcustom org-link-mailto-program '(browse-url "mailto:%a?subject=%s")
1657 "Function and arguments to call for following mailto links.
1658 This is a list with the first element being a Lisp function, and the
1659 remaining elements being arguments to the function. In string arguments,
1660 %a will be replaced by the address, and %s will be replaced by the subject
1661 if one was given like in < subject>."
1662 :group 'org-link-follow
1663 :type '(choice
1664 (const :tag "browse-url" (browse-url-mail "mailto:%a?subject=%s"))
1665 (const :tag "compose-mail" (compose-mail "%a" "%s"))
1666 (const :tag "message-mail" (message-mail "%a" "%s"))
1667 (cons :tag "other" (function) (repeat :tag "argument" sexp))))
1669 (defcustom org-confirm-shell-link-function 'yes-or-no-p
1670 "Non-nil means ask for confirmation before executing shell links.
1671 Shell links can be dangerous: just think about a link
1673 [[shell:rm -rf ~/*][Google Search]]
1675 This link would show up in your Org-mode document as \"Google Search\",
1676 but really it would remove your entire home directory.
1677 Therefore we advise against setting this variable to nil.
1678 Just change it to `y-or-n-p' if you want to confirm with a
1679 single keystroke rather than having to type \"yes\"."
1680 :group 'org-link-follow
1681 :type '(choice
1682 (const :tag "with yes-or-no (safer)" yes-or-no-p)
1683 (const :tag "with y-or-n (faster)" y-or-n-p)
1684 (const :tag "no confirmation (dangerous)" nil)))
1685 (put 'org-confirm-shell-link-function
1686 'safe-local-variable
1687 #'(lambda (x) (member x '(yes-or-no-p y-or-n-p))))
1689 (defcustom org-confirm-shell-link-not-regexp ""
1690 "A regexp to skip confirmation for shell links."
1691 :group 'org-link-follow
1692 :version "24.1"
1693 :type 'regexp)
1695 (defcustom org-confirm-elisp-link-function 'yes-or-no-p
1696 "Non-nil means ask for confirmation before executing Emacs Lisp links.
1697 Elisp links can be dangerous: just think about a link
1699 [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]]
1701 This link would show up in your Org-mode document as \"Google Search\",
1702 but really it would remove your entire home directory.
1703 Therefore we advise against setting this variable to nil.
1704 Just change it to `y-or-n-p' if you want to confirm with a
1705 single keystroke rather than having to type \"yes\"."
1706 :group 'org-link-follow
1707 :type '(choice
1708 (const :tag "with yes-or-no (safer)" yes-or-no-p)
1709 (const :tag "with y-or-n (faster)" y-or-n-p)
1710 (const :tag "no confirmation (dangerous)" nil)))
1711 (put 'org-confirm-shell-link-function
1712 'safe-local-variable
1713 #'(lambda (x) (member x '(yes-or-no-p y-or-n-p))))
1715 (defcustom org-confirm-elisp-link-not-regexp ""
1716 "A regexp to skip confirmation for Elisp links."
1717 :group 'org-link-follow
1718 :version "24.1"
1719 :type 'regexp)
1721 (defconst org-file-apps-defaults-gnu
1722 '((remote . emacs)
1723 (system . mailcap)
1724 (t . mailcap))
1725 "Default file applications on a UNIX or GNU/Linux system.
1726 See `org-file-apps'.")
1728 (defconst org-file-apps-defaults-macosx
1729 '((remote . emacs)
1730 (t . "open %s")
1731 (system . "open %s")
1732 ("ps.gz" . "gv %s")
1733 ("eps.gz" . "gv %s")
1734 ("dvi" . "xdvi %s")
1735 ("fig" . "xfig %s"))
1736 "Default file applications on a MacOS X system.
1737 The system \"open\" is known as a default, but we use X11 applications
1738 for some files for which the OS does not have a good default.
1739 See `org-file-apps'.")
1741 (defconst org-file-apps-defaults-windowsnt
1742 (list
1743 '(remote . emacs)
1744 (cons t
1745 (list (if (featurep 'xemacs)
1746 'mswindows-shell-execute
1747 'w32-shell-execute)
1748 "open" 'file))
1749 (cons 'system
1750 (list (if (featurep 'xemacs)
1751 'mswindows-shell-execute
1752 'w32-shell-execute)
1753 "open" 'file)))
1754 "Default file applications on a Windows NT system.
1755 The system \"open\" is used for most files.
1756 See `org-file-apps'.")
1758 (defcustom org-file-apps
1760 (auto-mode . emacs)
1761 ("\\.mm\\'" . default)
1762 ("\\.x?html?\\'" . default)
1763 ("\\.pdf\\'" . default)
1765 "External applications for opening `file:path' items in a document.
1766 Org-mode uses system defaults for different file types, but
1767 you can use this variable to set the application for a given file
1768 extension. The entries in this list are cons cells where the car identifies
1769 files and the cdr the corresponding command. Possible values for the
1770 file identifier are
1771 \"string\" A string as a file identifier can be interpreted in different
1772 ways, depending on its contents:
1774 - Alphanumeric characters only:
1775 Match links with this file extension.
1776 Example: (\"pdf\" . \"evince %s\")
1777 to open PDFs with evince.
1779 - Regular expression: Match links where the
1780 filename matches the regexp. If you want to
1781 use groups here, use shy groups.
1783 Example: (\"\\.x?html\\'\" . \"firefox %s\")
1784 (\"\\(?:xhtml\\|html\\)\" . \"firefox %s\")
1785 to open *.html and *.xhtml with firefox.
1787 - Regular expression which contains (non-shy) groups:
1788 Match links where the whole link, including \"::\", and
1789 anything after that, matches the regexp.
1790 In a custom command string, %1, %2, etc. are replaced with
1791 the parts of the link that were matched by the groups.
1792 For backwards compatibility, if a command string is given
1793 that does not use any of the group matches, this case is
1794 handled identically to the second one (i.e. match against
1795 file name only).
1796 In a custom lisp form, you can access the group matches with
1797 (match-string n link).
1799 Example: (\"\\.pdf::\\(\\d+\\)\\'\" . \"evince -p %1 %s\")
1800 to open [[file:document.pdf::5]] with evince at page 5.
1802 `directory' Matches a directory
1803 `remote' Matches a remote file, accessible through tramp or efs.
1804 Remote files most likely should be visited through Emacs
1805 because external applications cannot handle such paths.
1806 `auto-mode' Matches files that are matched by any entry in `auto-mode-alist',
1807 so all files Emacs knows how to handle. Using this with
1808 command `emacs' will open most files in Emacs. Beware that this
1809 will also open html files inside Emacs, unless you add
1810 (\"html\" . default) to the list as well.
1811 t Default for files not matched by any of the other options.
1812 `system' The system command to open files, like `open' on Windows
1813 and Mac OS X, and mailcap under GNU/Linux. This is the command
1814 that will be selected if you call `C-c C-o' with a double
1815 \\[universal-argument] \\[universal-argument] prefix.
1817 Possible values for the command are:
1818 `emacs' The file will be visited by the current Emacs process.
1819 `default' Use the default application for this file type, which is the
1820 association for t in the list, most likely in the system-specific
1821 part.
1822 This can be used to overrule an unwanted setting in the
1823 system-specific variable.
1824 `system' Use the system command for opening files, like \"open\".
1825 This command is specified by the entry whose car is `system'.
1826 Most likely, the system-specific version of this variable
1827 does define this command, but you can overrule/replace it
1828 here.
1829 string A command to be executed by a shell; %s will be replaced
1830 by the path to the file.
1831 sexp A Lisp form which will be evaluated. The file path will
1832 be available in the Lisp variable `file'.
1833 For more examples, see the system specific constants
1834 `org-file-apps-defaults-macosx'
1835 `org-file-apps-defaults-windowsnt'
1836 `org-file-apps-defaults-gnu'."
1837 :group 'org-link-follow
1838 :type '(repeat
1839 (cons (choice :value ""
1840 (string :tag "Extension")
1841 (const :tag "System command to open files" system)
1842 (const :tag "Default for unrecognized files" t)
1843 (const :tag "Remote file" remote)
1844 (const :tag "Links to a directory" directory)
1845 (const :tag "Any files that have Emacs modes"
1846 auto-mode))
1847 (choice :value ""
1848 (const :tag "Visit with Emacs" emacs)
1849 (const :tag "Use default" default)
1850 (const :tag "Use the system command" system)
1851 (string :tag "Command")
1852 (sexp :tag "Lisp form")))))
1854 (defcustom org-doi-server-url ""
1855 "The URL of the DOI server."
1856 :type 'string
1857 :version "24.3"
1858 :group 'org-link-follow)
1860 (defgroup org-refile nil
1861 "Options concerning refiling entries in Org-mode."
1862 :tag "Org Refile"
1863 :group 'org)
1865 (defcustom org-directory "~/org"
1866 "Directory with org files.
1867 This is just a default location to look for Org files. There is no need
1868 at all to put your files into this directory. It is only used in the
1869 following situations:
1871 1. When a capture template specifies a target file that is not an
1872 absolute path. The path will then be interpreted relative to
1873 `org-directory'
1874 2. When a capture note is filed away in an interactive way (when exiting the
1875 note buffer with `C-1 C-c C-c'. The user is prompted for an org file,
1876 with `org-directory' as the default path."
1877 :group 'org-refile
1878 :group 'org-remember
1879 :group 'org-capture
1880 :type 'directory)
1882 (defcustom org-default-notes-file (convert-standard-filename "~/.notes")
1883 "Default target for storing notes.
1884 Used as a fall back file for org-remember.el and org-capture.el, for
1885 templates that do not specify a target file."
1886 :group 'org-refile
1887 :group 'org-remember
1888 :group 'org-capture
1889 :type '(choice
1890 (const :tag "Default from remember-data-file" nil)
1891 file))
1893 (defcustom org-goto-interface 'outline
1894 "The default interface to be used for `org-goto'.
1895 Allowed values are:
1896 outline The interface shows an outline of the relevant file
1897 and the correct heading is found by moving through
1898 the outline or by searching with incremental search.
1899 outline-path-completion Headlines in the current buffer are offered via
1900 completion. This is the interface also used by
1901 the refile command."
1902 :group 'org-refile
1903 :type '(choice
1904 (const :tag "Outline" outline)
1905 (const :tag "Outline-path-completion" outline-path-completion)))
1907 (defcustom org-goto-max-level 5
1908 "Maximum target level when running `org-goto' with refile interface."
1909 :group 'org-refile
1910 :type 'integer)
1912 (defcustom org-reverse-note-order nil
1913 "Non-nil means store new notes at the beginning of a file or entry.
1914 When nil, new notes will be filed to the end of a file or entry.
1915 This can also be a list with cons cells of regular expressions that
1916 are matched against file names, and values."
1917 :group 'org-remember
1918 :group 'org-capture
1919 :group 'org-refile
1920 :type '(choice
1921 (const :tag "Reverse always" t)
1922 (const :tag "Reverse never" nil)
1923 (repeat :tag "By file name regexp"
1924 (cons regexp boolean))))
1926 (defcustom org-log-refile nil
1927 "Information to record when a task is refiled.
1929 Possible values are:
1931 nil Don't add anything
1932 time Add a time stamp to the task
1933 note Prompt for a note and add it with template `org-log-note-headings'
1935 This option can also be set with on a per-file-basis with
1937 #+STARTUP: nologrefile
1938 #+STARTUP: logrefile
1939 #+STARTUP: lognoterefile
1941 You can have local logging settings for a subtree by setting the LOGGING
1942 property to one or more of these keywords.
1944 When bulk-refiling from the agenda, the value `note' is forbidden and
1945 will temporarily be changed to `time'."
1946 :group 'org-refile
1947 :group 'org-progress
1948 :version "24.1"
1949 :type '(choice
1950 (const :tag "No logging" nil)
1951 (const :tag "Record timestamp" time)
1952 (const :tag "Record timestamp with note." note)))
1954 (defcustom org-refile-targets nil
1955 "Targets for refiling entries with \\[org-refile].
1956 This is a list of cons cells. Each cell contains:
1957 - a specification of the files to be considered, either a list of files,
1958 or a symbol whose function or variable value will be used to retrieve
1959 a file name or a list of file names. If you use `org-agenda-files' for
1960 that, all agenda files will be scanned for targets. Nil means consider
1961 headings in the current buffer.
1962 - A specification of how to find candidate refile targets. This may be
1963 any of:
1964 - a cons cell (:tag . \"TAG\") to identify refile targets by a tag.
1965 This tag has to be present in all target headlines, inheritance will
1966 not be considered.
1967 - a cons cell (:todo . \"KEYWORD\") to identify refile targets by
1968 todo keyword.
1969 - a cons cell (:regexp . \"REGEXP\") with a regular expression matching
1970 headlines that are refiling targets.
1971 - a cons cell (:level . N). Any headline of level N is considered a target.
1972 Note that, when `org-odd-levels-only' is set, level corresponds to
1973 order in hierarchy, not to the number of stars.
1974 - a cons cell (:maxlevel . N). Any headline with level <= N is a target.
1975 Note that, when `org-odd-levels-only' is set, level corresponds to
1976 order in hierarchy, not to the number of stars.
1978 Each element of this list generates a set of possible targets.
1979 The union of these sets is presented (with completion) to
1980 the user by `org-refile'.
1982 You can set the variable `org-refile-target-verify-function' to a function
1983 to verify each headline found by the simple criteria above.
1985 When this variable is nil, all top-level headlines in the current buffer
1986 are used, equivalent to the value `((nil . (:level . 1))'."
1987 :group 'org-refile
1988 :type '(repeat
1989 (cons
1990 (choice :value org-agenda-files
1991 (const :tag "All agenda files" org-agenda-files)
1992 (const :tag "Current buffer" nil)
1993 (function) (variable) (file))
1994 (choice :tag "Identify target headline by"
1995 (cons :tag "Specific tag" (const :value :tag) (string))
1996 (cons :tag "TODO keyword" (const :value :todo) (string))
1997 (cons :tag "Regular expression" (const :value :regexp) (regexp))
1998 (cons :tag "Level number" (const :value :level) (integer))
1999 (cons :tag "Max Level number" (const :value :maxlevel) (integer))))))
2001 (defcustom org-refile-target-verify-function nil
2002 "Function to verify if the headline at point should be a refile target.
2003 The function will be called without arguments, with point at the
2004 beginning of the headline. It should return t and leave point
2005 where it is if the headline is a valid target for refiling.
2007 If the target should not be selected, the function must return nil.
2008 In addition to this, it may move point to a place from where the search
2009 should be continued. For example, the function may decide that the entire
2010 subtree of the current entry should be excluded and move point to the end
2011 of the subtree."
2012 :group 'org-refile
2013 :type 'function)
2015 (defcustom org-refile-use-cache nil
2016 "Non-nil means cache refile targets to speed up the process.
2017 The cache for a particular file will be updated automatically when
2018 the buffer has been killed, or when any of the marker used for flagging
2019 refile targets no longer points at a live buffer.
2020 If you have added new entries to a buffer that might themselves be targets,
2021 you need to clear the cache manually by pressing `C-0 C-c C-w' or, if you
2022 find that easier, `C-u C-u C-u C-c C-w'."
2023 :group 'org-refile
2024 :version "24.1"
2025 :type 'boolean)
2027 (defcustom org-refile-use-outline-path nil
2028 "Non-nil means provide refile targets as paths.
2029 So a level 3 headline will be available as level1/level2/level3.
2031 When the value is `file', also include the file name (without directory)
2032 into the path. In this case, you can also stop the completion after
2033 the file name, to get entries inserted as top level in the file.
2035 When `full-file-path', include the full file path."
2036 :group 'org-refile
2037 :type '(choice
2038 (const :tag "Not" nil)
2039 (const :tag "Yes" t)
2040 (const :tag "Start with file name" file)
2041 (const :tag "Start with full file path" full-file-path)))
2043 (defcustom org-outline-path-complete-in-steps t
2044 "Non-nil means complete the outline path in hierarchical steps.
2045 When Org-mode uses the refile interface to select an outline path
2046 \(see variable `org-refile-use-outline-path'), the completion of
2047 the path can be done is a single go, or if can be done in steps down
2048 the headline hierarchy. Going in steps is probably the best if you
2049 do not use a special completion package like `ido' or `icicles'.
2050 However, when using these packages, going in one step can be very
2051 fast, while still showing the whole path to the entry."
2052 :group 'org-refile
2053 :type 'boolean)
2055 (defcustom org-refile-allow-creating-parent-nodes nil
2056 "Non-nil means allow to create new nodes as refile targets.
2057 New nodes are then created by adding \"/new node name\" to the completion
2058 of an existing node. When the value of this variable is `confirm',
2059 new node creation must be confirmed by the user (recommended)
2060 When nil, the completion must match an existing entry.
2062 Note that, if the new heading is not seen by the criteria
2063 listed in `org-refile-targets', multiple instances of the same
2064 heading would be created by trying again to file under the new
2065 heading."
2066 :group 'org-refile
2067 :type '(choice
2068 (const :tag "Never" nil)
2069 (const :tag "Always" t)
2070 (const :tag "Prompt for confirmation" confirm)))
2072 (defcustom org-refile-active-region-within-subtree nil
2073 "Non-nil means also refile active region within a subtree.
2075 By default `org-refile' doesn't allow refiling regions if they
2076 don't contain a set of subtrees, but it might be convenient to
2077 do so sometimes: in that case, the first line of the region is
2078 converted to a headline before refiling."
2079 :group 'org-refile
2080 :version "24.1"
2081 :type 'boolean)
2083 (defgroup org-todo nil
2084 "Options concerning TODO items in Org-mode."
2085 :tag "Org TODO"
2086 :group 'org)
2088 (defgroup org-progress nil
2089 "Options concerning Progress logging in Org-mode."
2090 :tag "Org Progress"
2091 :group 'org-time)
2093 (defvar org-todo-interpretation-widgets
2094 '((:tag "Sequence (cycling hits every state)" sequence)
2095 (:tag "Type (cycling directly to DONE)" type))
2096 "The available interpretation symbols for customizing `org-todo-keywords'.
2097 Interested libraries should add to this list.")
2099 (defcustom org-todo-keywords '((sequence "TODO" "DONE"))
2100 "List of TODO entry keyword sequences and their interpretation.
2101 \\<org-mode-map>This is a list of sequences.
2103 Each sequence starts with a symbol, either `sequence' or `type',
2104 indicating if the keywords should be interpreted as a sequence of
2105 action steps, or as different types of TODO items. The first
2106 keywords are states requiring action - these states will select a headline
2107 for inclusion into the global TODO list Org-mode produces. If one of
2108 the \"keywords\" is the vertical bar, \"|\", the remaining keywords
2109 signify that no further action is necessary. If \"|\" is not found,
2110 the last keyword is treated as the only DONE state of the sequence.
2112 The command \\[org-todo] cycles an entry through these states, and one
2113 additional state where no keyword is present. For details about this
2114 cycling, see the manual.
2116 TODO keywords and interpretation can also be set on a per-file basis with
2117 the special #+SEQ_TODO and #+TYP_TODO lines.
2119 Each keyword can optionally specify a character for fast state selection
2120 \(in combination with the variable `org-use-fast-todo-selection')
2121 and specifiers for state change logging, using the same syntax that
2122 is used in the \"#+TODO:\" lines. For example, \"WAIT(w)\" says that
2123 the WAIT state can be selected with the \"w\" key. \"WAIT(w!)\"
2124 indicates to record a time stamp each time this state is selected.
2126 Each keyword may also specify if a timestamp or a note should be
2127 recorded when entering or leaving the state, by adding additional
2128 characters in the parenthesis after the keyword. This looks like this:
2129 \"WAIT(w@/!)\". \"@\" means to add a note (with time), \"!\" means to
2130 record only the time of the state change. With X and Y being either
2131 \"@\" or \"!\", \"X/Y\" means use X when entering the state, and use
2132 Y when leaving the state if and only if the *target* state does not
2133 define X. You may omit any of the fast-selection key or X or /Y,
2134 so WAIT(w@), WAIT(w/@) and WAIT(@/@) are all valid.
2136 For backward compatibility, this variable may also be just a list
2137 of keywords. In this case the interpretation (sequence or type) will be
2138 taken from the (otherwise obsolete) variable `org-todo-interpretation'."
2139 :group 'org-todo
2140 :group 'org-keywords
2141 :type '(choice
2142 (repeat :tag "Old syntax, just keywords"
2143 (string :tag "Keyword"))
2144 (repeat :tag "New syntax"
2145 (cons
2146 (choice
2147 :tag "Interpretation"
2148 ;;Quick and dirty way to see
2149 ;;`org-todo-interpretations'. This takes the
2150 ;;place of item arguments
2151 :convert-widget
2152 (lambda (widget)
2153 (widget-put widget
2154 :args (mapcar
2155 #'(lambda (x)
2156 (widget-convert
2157 (cons 'const x)))
2158 org-todo-interpretation-widgets))
2159 widget))
2160 (repeat
2161 (string :tag "Keyword"))))))
2163 (defvar org-todo-keywords-1 nil
2164 "All TODO and DONE keywords active in a buffer.")
2165 (make-variable-buffer-local 'org-todo-keywords-1)
2166 (defvar org-todo-keywords-for-agenda nil)
2167 (defvar org-done-keywords-for-agenda nil)
2168 (defvar org-drawers-for-agenda nil)
2169 (defvar org-todo-keyword-alist-for-agenda nil)
2170 (defvar org-tag-alist-for-agenda nil)
2171 (defvar org-agenda-contributing-files nil)
2172 (defvar org-not-done-keywords nil)
2173 (make-variable-buffer-local 'org-not-done-keywords)
2174 (defvar org-done-keywords nil)
2175 (make-variable-buffer-local 'org-done-keywords)
2176 (defvar org-todo-heads nil)
2177 (make-variable-buffer-local 'org-todo-heads)
2178 (defvar org-todo-sets nil)
2179 (make-variable-buffer-local 'org-todo-sets)
2180 (defvar org-todo-log-states nil)
2181 (make-variable-buffer-local 'org-todo-log-states)
2182 (defvar org-todo-kwd-alist nil)
2183 (make-variable-buffer-local 'org-todo-kwd-alist)
2184 (defvar org-todo-key-alist nil)
2185 (make-variable-buffer-local 'org-todo-key-alist)
2186 (defvar org-todo-key-trigger nil)
2187 (make-variable-buffer-local 'org-todo-key-trigger)
2189 (defcustom org-todo-interpretation 'sequence
2190 "Controls how TODO keywords are interpreted.
2191 This variable is in principle obsolete and is only used for
2192 backward compatibility, if the interpretation of todo keywords is
2193 not given already in `org-todo-keywords'. See that variable for
2194 more information."
2195 :group 'org-todo
2196 :group 'org-keywords
2197 :type '(choice (const sequence)
2198 (const type)))
2200 (defcustom org-use-fast-todo-selection t
2201 "Non-nil means use the fast todo selection scheme with C-c C-t.
2202 This variable describes if and under what circumstances the cycling
2203 mechanism for TODO keywords will be replaced by a single-key, direct
2204 selection scheme.
2206 When nil, fast selection is never used.
2208 When the symbol `prefix', it will be used when `org-todo' is called
2209 with a prefix argument, i.e. `C-u C-c C-t' in an Org-mode buffer, and
2210 `C-u t' in an agenda buffer.
2212 When t, fast selection is used by default. In this case, the prefix
2213 argument forces cycling instead.
2215 In all cases, the special interface is only used if access keys have
2216 actually been assigned by the user, i.e. if keywords in the configuration
2217 are followed by a letter in parenthesis, like TODO(t)."
2218 :group 'org-todo
2219 :type '(choice
2220 (const :tag "Never" nil)
2221 (const :tag "By default" t)
2222 (const :tag "Only with C-u C-c C-t" prefix)))
2224 (defcustom org-provide-todo-statistics t
2225 "Non-nil means update todo statistics after insert and toggle.
2226 ALL-HEADLINES means update todo statistics by including headlines
2227 with no TODO keyword as well, counting them as not done.
2228 A list of TODO keywords means the same, but skip keywords that are
2229 not in this list.
2231 When this is set, todo statistics is updated in the parent of the
2232 current entry each time a todo state is changed."
2233 :group 'org-todo
2234 :type '(choice
2235 (const :tag "Yes, only for TODO entries" t)
2236 (const :tag "Yes, including all entries" 'all-headlines)
2237 (repeat :tag "Yes, for TODOs in this list"
2238 (string :tag "TODO keyword"))
2239 (other :tag "No TODO statistics" nil)))
2241 (defcustom org-hierarchical-todo-statistics t
2242 "Non-nil means TODO statistics covers just direct children.
2243 When nil, all entries in the subtree are considered.
2244 This has only an effect if `org-provide-todo-statistics' is set.
2245 To set this to nil for only a single subtree, use a COOKIE_DATA
2246 property and include the word \"recursive\" into the value."
2247 :group 'org-todo
2248 :type 'boolean)
2250 (defcustom org-after-todo-state-change-hook nil
2251 "Hook which is run after the state of a TODO item was changed.
2252 The new state (a string with a TODO keyword, or nil) is available in the
2253 Lisp variable `org-state'."
2254 :group 'org-todo
2255 :type 'hook)
2257 (defvar org-blocker-hook nil
2258 "Hook for functions that are allowed to block a state change.
2260 Functions in this hook should not modify the buffer.
2261 Each function gets as its single argument a property list,
2262 see `org-trigger-hook' for more information about this list.
2264 If any of the functions in this hook returns nil, the state change
2265 is blocked.")
2267 (defvar org-trigger-hook nil
2268 "Hook for functions that are triggered by a state change.
2270 Each function gets as its single argument a property list with at
2271 least the following elements:
2273 (:type type-of-change :position pos-at-entry-start
2274 :from old-state :to new-state)
2276 Depending on the type, more properties may be present.
2278 This mechanism is currently implemented for:
2280 TODO state changes
2281 ------------------
2282 :type todo-state-change
2283 :from previous state (keyword as a string), or nil, or a symbol
2284 'todo' or 'done', to indicate the general type of state.
2285 :to new state, like in :from")
2287 (defcustom org-enforce-todo-dependencies nil
2288 "Non-nil means undone TODO entries will block switching the parent to DONE.
2289 Also, if a parent has an :ORDERED: property, switching an entry to DONE will
2290 be blocked if any prior sibling is not yet done.
2291 Finally, if the parent is blocked because of ordered siblings of its own,
2292 the child will also be blocked."
2293 :set (lambda (var val)
2294 (set var val)
2295 (if val
2296 (add-hook 'org-blocker-hook
2297 'org-block-todo-from-children-or-siblings-or-parent)
2298 (remove-hook 'org-blocker-hook
2299 'org-block-todo-from-children-or-siblings-or-parent)))
2300 :group 'org-todo
2301 :type 'boolean)
2303 (defcustom org-enforce-todo-checkbox-dependencies nil
2304 "Non-nil means unchecked boxes will block switching the parent to DONE.
2305 When this is nil, checkboxes have no influence on switching TODO states.
2306 When non-nil, you first need to check off all check boxes before the TODO
2307 entry can be switched to DONE.
2308 This variable needs to be set before org.el is loaded, and you need to
2309 restart Emacs after a change to make the change effective. The only way
2310 to change is while Emacs is running is through the customize interface."
2311 :set (lambda (var val)
2312 (set var val)
2313 (if val
2314 (add-hook 'org-blocker-hook
2315 'org-block-todo-from-checkboxes)
2316 (remove-hook 'org-blocker-hook
2317 'org-block-todo-from-checkboxes)))
2318 :group 'org-todo
2319 :type 'boolean)
2321 (defcustom org-treat-insert-todo-heading-as-state-change nil
2322 "Non-nil means inserting a TODO heading is treated as state change.
2323 So when the command \\[org-insert-todo-heading] is used, state change
2324 logging will apply if appropriate. When nil, the new TODO item will
2325 be inserted directly, and no logging will take place."
2326 :group 'org-todo
2327 :type 'boolean)
2329 (defcustom org-treat-S-cursor-todo-selection-as-state-change t
2330 "Non-nil means switching TODO states with S-cursor counts as state change.
2331 This is the default behavior. However, setting this to nil allows a
2332 convenient way to select a TODO state and bypass any logging associated
2333 with that."
2334 :group 'org-todo
2335 :type 'boolean)
2337 (defcustom org-todo-state-tags-triggers nil
2338 "Tag changes that should be triggered by TODO state changes.
2339 This is a list. Each entry is
2341 (state-change (tag . flag) .......)
2343 State-change can be a string with a state, and empty string to indicate the
2344 state that has no TODO keyword, or it can be one of the symbols `todo'
2345 or `done', meaning any not-done or done state, respectively."
2346 :group 'org-todo
2347 :group 'org-tags
2348 :type '(repeat
2349 (cons (choice :tag "When changing to"
2350 (const :tag "Not-done state" todo)
2351 (const :tag "Done state" done)
2352 (string :tag "State"))
2353 (repeat
2354 (cons :tag "Tag action"
2355 (string :tag "Tag")
2356 (choice (const :tag "Add" t) (const :tag "Remove" nil)))))))
2358 (defcustom org-log-done nil
2359 "Information to record when a task moves to the DONE state.
2361 Possible values are:
2363 nil Don't add anything, just change the keyword
2364 time Add a time stamp to the task
2365 note Prompt for a note and add it with template `org-log-note-headings'
2367 This option can also be set with on a per-file-basis with
2369 #+STARTUP: nologdone
2370 #+STARTUP: logdone
2371 #+STARTUP: lognotedone
2373 You can have local logging settings for a subtree by setting the LOGGING
2374 property to one or more of these keywords."
2375 :group 'org-todo
2376 :group 'org-progress
2377 :type '(choice
2378 (const :tag "No logging" nil)
2379 (const :tag "Record CLOSED timestamp" time)
2380 (const :tag "Record CLOSED timestamp with note." note)))
2382 ;; Normalize old uses of org-log-done.
2383 (cond
2384 ((eq org-log-done t) (setq org-log-done 'time))
2385 ((and (listp org-log-done) (memq 'done org-log-done))
2386 (setq org-log-done 'note)))
2388 (defcustom org-log-reschedule nil
2389 "Information to record when the scheduling date of a tasks is modified.
2391 Possible values are:
2393 nil Don't add anything, just change the date
2394 time Add a time stamp to the task
2395 note Prompt for a note and add it with template `org-log-note-headings'
2397 This option can also be set with on a per-file-basis with
2399 #+STARTUP: nologreschedule
2400 #+STARTUP: logreschedule
2401 #+STARTUP: lognotereschedule"
2402 :group 'org-todo
2403 :group 'org-progress
2404 :type '(choice
2405 (const :tag "No logging" nil)
2406 (const :tag "Record timestamp" time)
2407 (const :tag "Record timestamp with note." note)))
2409 (defcustom org-log-redeadline nil
2410 "Information to record when the deadline date of a tasks is modified.
2412 Possible values are:
2414 nil Don't add anything, just change the date
2415 time Add a time stamp to the task
2416 note Prompt for a note and add it with template `org-log-note-headings'
2418 This option can also be set with on a per-file-basis with
2420 #+STARTUP: nologredeadline
2421 #+STARTUP: logredeadline
2422 #+STARTUP: lognoteredeadline
2424 You can have local logging settings for a subtree by setting the LOGGING
2425 property to one or more of these keywords."
2426 :group 'org-todo
2427 :group 'org-progress
2428 :type '(choice
2429 (const :tag "No logging" nil)
2430 (const :tag "Record timestamp" time)
2431 (const :tag "Record timestamp with note." note)))
2433 (defcustom org-log-note-clock-out nil
2434 "Non-nil means record a note when clocking out of an item.
2435 This can also be configured on a per-file basis by adding one of
2436 the following lines anywhere in the buffer:
2438 #+STARTUP: lognoteclock-out
2439 #+STARTUP: nolognoteclock-out"
2440 :group 'org-todo
2441 :group 'org-progress
2442 :type 'boolean)
2444 (defcustom org-log-done-with-time t
2445 "Non-nil means the CLOSED time stamp will contain date and time.
2446 When nil, only the date will be recorded."
2447 :group 'org-progress
2448 :type 'boolean)
2450 (defcustom org-log-note-headings
2451 '((done . "CLOSING NOTE %t")
2452 (state . "State %-12s from %-12S %t")
2453 (note . "Note taken on %t")
2454 (reschedule . "Rescheduled from %S on %t")
2455 (delschedule . "Not scheduled, was %S on %t")
2456 (redeadline . "New deadline from %S on %t")
2457 (deldeadline . "Removed deadline, was %S on %t")
2458 (refile . "Refiled on %t")
2459 (clock-out . ""))
2460 "Headings for notes added to entries.
2461 The value is an alist, with the car being a symbol indicating the note
2462 context, and the cdr is the heading to be used. The heading may also be the
2463 empty string.
2464 %t in the heading will be replaced by a time stamp.
2465 %T will be an active time stamp instead the default inactive one
2466 %d will be replaced by a short-format time stamp.
2467 %D will be replaced by an active short-format time stamp.
2468 %s will be replaced by the new TODO state, in double quotes.
2469 %S will be replaced by the old TODO state, in double quotes.
2470 %u will be replaced by the user name.
2471 %U will be replaced by the full user name.
2473 In fact, it is not a good idea to change the `state' entry, because
2474 agenda log mode depends on the format of these entries."
2475 :group 'org-todo
2476 :group 'org-progress
2477 :type '(list :greedy t
2478 (cons (const :tag "Heading when closing an item" done) string)
2479 (cons (const :tag
2480 "Heading when changing todo state (todo sequence only)"
2481 state) string)
2482 (cons (const :tag "Heading when just taking a note" note) string)
2483 (cons (const :tag "Heading when clocking out" clock-out) string)
2484 (cons (const :tag "Heading when an item is no longer scheduled" delschedule) string)
2485 (cons (const :tag "Heading when rescheduling" reschedule) string)
2486 (cons (const :tag "Heading when changing deadline" redeadline) string)
2487 (cons (const :tag "Heading when deleting a deadline" deldeadline) string)
2488 (cons (const :tag "Heading when refiling" refile) string)))
2490 (unless (assq 'note org-log-note-headings)
2491 (push '(note . "%t") org-log-note-headings))
2493 (defcustom org-log-into-drawer nil
2494 "Non-nil means insert state change notes and time stamps into a drawer.
2495 When nil, state changes notes will be inserted after the headline and
2496 any scheduling and clock lines, but not inside a drawer.
2498 The value of this variable should be the name of the drawer to use.
2499 LOGBOOK is proposed as the default drawer for this purpose, you can
2500 also set this to a string to define the drawer of your choice.
2502 A value of t is also allowed, representing \"LOGBOOK\".
2504 A value of t or nil can also be set with on a per-file-basis with
2506 #+STARTUP: logdrawer
2507 #+STARTUP: nologdrawer
2509 If this variable is set, `org-log-state-notes-insert-after-drawers'
2510 will be ignored.
2512 You can set the property LOG_INTO_DRAWER to overrule this setting for
2513 a subtree."
2514 :group 'org-todo
2515 :group 'org-progress
2516 :type '(choice
2517 (const :tag "Not into a drawer" nil)
2518 (const :tag "LOGBOOK" t)
2519 (string :tag "Other")))
2521 (if (fboundp 'defvaralias)
2522 (defvaralias 'org-log-state-notes-into-drawer 'org-log-into-drawer))
2524 (defun org-log-into-drawer ()
2525 "Return the value of `org-log-into-drawer', but let properties overrule.
2526 If the current entry has or inherits a LOG_INTO_DRAWER property, it will be
2527 used instead of the default value."
2528 (let ((p (org-entry-get nil "LOG_INTO_DRAWER" 'inherit t)))
2529 (cond
2530 ((not p) org-log-into-drawer)
2531 ((equal p "nil") nil)
2532 ((equal p "t") "LOGBOOK")
2533 (t p))))
2535 (defcustom org-log-state-notes-insert-after-drawers nil
2536 "Non-nil means insert state change notes after any drawers in entry.
2537 Only the drawers that *immediately* follow the headline and the
2538 deadline/scheduled line are skipped.
2539 When nil, insert notes right after the heading and perhaps the line
2540 with deadline/scheduling if present.
2542 This variable will have no effect if `org-log-into-drawer' is
2543 set."
2544 :group 'org-todo
2545 :group 'org-progress
2546 :type 'boolean)
2548 (defcustom org-log-states-order-reversed t
2549 "Non-nil means the latest state note will be directly after heading.
2550 When nil, the state change notes will be ordered according to time.
2552 This option can also be set with on a per-file-basis with
2554 #+STARTUP: logstatesreversed
2555 #+STARTUP: nologstatesreversed"
2556 :group 'org-todo
2557 :group 'org-progress
2558 :type 'boolean)
2560 (defcustom org-todo-repeat-to-state nil
2561 "The TODO state to which a repeater should return the repeating task.
2562 By default this is the first task in a TODO sequence, or the previous state
2563 in a TODO_TYP set. But you can specify another task here.
2564 alternatively, set the :REPEAT_TO_STATE: property of the entry."
2565 :group 'org-todo
2566 :version "24.1"
2567 :type '(choice (const :tag "Head of sequence" nil)
2568 (string :tag "Specific state")))
2570 (defcustom org-log-repeat 'time
2571 "Non-nil means record moving through the DONE state when triggering repeat.
2572 An auto-repeating task is immediately switched back to TODO when
2573 marked DONE. If you are not logging state changes (by adding \"@\"
2574 or \"!\" to the TODO keyword definition), or set `org-log-done' to
2575 record a closing note, there will be no record of the task moving
2576 through DONE. This variable forces taking a note anyway.
2578 nil Don't force a record
2579 time Record a time stamp
2580 note Prompt for a note and add it with template `org-log-note-headings'
2582 This option can also be set with on a per-file-basis with
2584 #+STARTUP: nologrepeat
2585 #+STARTUP: logrepeat
2586 #+STARTUP: lognoterepeat
2588 You can have local logging settings for a subtree by setting the LOGGING
2589 property to one or more of these keywords."
2590 :group 'org-todo
2591 :group 'org-progress
2592 :type '(choice
2593 (const :tag "Don't force a record" nil)
2594 (const :tag "Force recording the DONE state" time)
2595 (const :tag "Force recording a note with the DONE state" note)))
2598 (defgroup org-priorities nil
2599 "Priorities in Org-mode."
2600 :tag "Org Priorities"
2601 :group 'org-todo)
2603 (defcustom org-enable-priority-commands t
2604 "Non-nil means priority commands are active.
2605 When nil, these commands will be disabled, so that you never accidentally
2606 set a priority."
2607 :group 'org-priorities
2608 :type 'boolean)
2610 (defcustom org-highest-priority ?A
2611 "The highest priority of TODO items. A character like ?A, ?B etc.
2612 Must have a smaller ASCII number than `org-lowest-priority'."
2613 :group 'org-priorities
2614 :type 'character)
2616 (defcustom org-lowest-priority ?C
2617 "The lowest priority of TODO items. A character like ?A, ?B etc.
2618 Must have a larger ASCII number than `org-highest-priority'."
2619 :group 'org-priorities
2620 :type 'character)
2622 (defcustom org-default-priority ?B
2623 "The default priority of TODO items.
2624 This is the priority an item gets if no explicit priority is given.
2625 When starting to cycle on an empty priority the first step in the cycle
2626 depends on `org-priority-start-cycle-with-default'. The resulting first
2627 step priority must not exceed the range from `org-highest-priority' to
2628 `org-lowest-priority' which means that `org-default-priority' has to be
2629 in this range exclusive or inclusive the range boundaries. Else the
2630 first step refuses to set the default and the second will fall back
2631 to (depending on the command used) the highest or lowest priority."
2632 :group 'org-priorities
2633 :type 'character)
2635 (defcustom org-priority-start-cycle-with-default t
2636 "Non-nil means start with default priority when starting to cycle.
2637 When this is nil, the first step in the cycle will be (depending on the
2638 command used) one higher or lower than the default priority.
2639 See also `org-default-priority'."
2640 :group 'org-priorities
2641 :type 'boolean)
2643 (defcustom org-get-priority-function nil
2644 "Function to extract the priority from a string.
2645 The string is normally the headline. If this is nil Org computes the
2646 priority from the priority cookie like [#A] in the headline. It returns
2647 an integer, increasing by 1000 for each priority level.
2648 The user can set a different function here, which should take a string
2649 as an argument and return the numeric priority."
2650 :group 'org-priorities
2651 :version "24.1"
2652 :type 'function)
2654 (defgroup org-time nil
2655 "Options concerning time stamps and deadlines in Org-mode."
2656 :tag "Org Time"
2657 :group 'org)
2659 (defcustom org-insert-labeled-timestamps-at-point nil
2660 "Non-nil means SCHEDULED and DEADLINE timestamps are inserted at point.
2661 When nil, these labeled time stamps are forces into the second line of an
2662 entry, just after the headline. When scheduling from the global TODO list,
2663 the time stamp will always be forced into the second line."
2664 :group 'org-time
2665 :type 'boolean)
2667 (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
2668 "Formats for `format-time-string' which are used for time stamps.
2669 It is not recommended to change this constant.")
2671 (defcustom org-time-stamp-rounding-minutes '(0 5)
2672 "Number of minutes to round time stamps to.
2673 These are two values, the first applies when first creating a time stamp.
2674 The second applies when changing it with the commands `S-up' and `S-down'.
2675 When changing the time stamp, this means that it will change in steps
2676 of N minutes, as given by the second value.
2678 When a setting is 0 or 1, insert the time unmodified. Useful rounding
2679 numbers should be factors of 60, so for example 5, 10, 15.
2681 When this is larger than 1, you can still force an exact time stamp by using
2682 a double prefix argument to a time stamp command like `C-c .' or `C-c !',
2683 and by using a prefix arg to `S-up/down' to specify the exact number
2684 of minutes to shift."
2685 :group 'org-time
2686 :get #'(lambda (var) ; Make sure both elements are there
2687 (if (integerp (default-value var))
2688 (list (default-value var) 5)
2689 (default-value var)))
2690 :type '(list
2691 (integer :tag "when inserting times")
2692 (integer :tag "when modifying times")))
2694 ;; Normalize old customizations of this variable.
2695 (when (integerp org-time-stamp-rounding-minutes)
2696 (setq org-time-stamp-rounding-minutes
2697 (list org-time-stamp-rounding-minutes
2698 org-time-stamp-rounding-minutes)))
2700 (defcustom org-display-custom-times nil
2701 "Non-nil means overlay custom formats over all time stamps.
2702 The formats are defined through the variable `org-time-stamp-custom-formats'.
2703 To turn this on on a per-file basis, insert anywhere in the file:
2704 #+STARTUP: customtime"
2705 :group 'org-time
2706 :set 'set-default
2707 :type 'sexp)
2708 (make-variable-buffer-local 'org-display-custom-times)
2710 (defcustom org-time-stamp-custom-formats
2711 '("<%m/%d/%y %a>" . "<%m/%d/%y %a %H:%M>") ; american
2712 "Custom formats for time stamps. See `format-time-string' for the syntax.
2713 These are overlaid over the default ISO format if the variable
2714 `org-display-custom-times' is set. Time like %H:%M should be at the
2715 end of the second format. The custom formats are also honored by export
2716 commands, if custom time display is turned on at the time of export."
2717 :group 'org-time
2718 :type 'sexp)
2720 (defun org-time-stamp-format (&optional long inactive)
2721 "Get the right format for a time string."
2722 (let ((f (if long (cdr org-time-stamp-formats)
2723 (car org-time-stamp-formats))))
2724 (if inactive
2725 (concat "[" (substring f 1 -1) "]")
2726 f)))
2728 (defcustom org-time-clocksum-format
2729 '(:days "%dd " :hours "%d" :require-hours t :minutes ":%02d" :require-minutes t)
2730 "The format string used when creating CLOCKSUM lines.
2731 This is also used when Org mode generates a time duration.
2733 The value can be a single format string containing two
2734 %-sequences, which will be filled with the number of hours and
2735 minutes in that order.
2737 Alternatively, the value can be a plist associating any of the
2738 keys :years, :months, :weeks, :days, :hours or :minutes with
2739 format strings. The time duration is formatted using only the
2740 time components that are needed and concatenating the results.
2741 If a time unit in absent, it falls back to the next smallest
2742 unit.
2744 The keys :require-years, :require-months, :require-days,
2745 :require-weeks, :require-hours, :require-minutes are also
2746 meaningful. A non-nil value for these keys indicates that the
2747 corresponding time component should always be included, even if
2748 its value is 0.
2751 For example,
2753 \(:days \"%dd\" :hours \"%d\" :require-hours t :minutes \":%02d\"
2754 :require-minutes t)
2756 means durations longer than a day will be expressed in days,
2757 hours and minutes, and durations less than a day will always be
2758 expressed in hours and minutes (even for durations less than an
2759 hour).
2761 The value
2763 \(:days \"%dd\" :minutes \"%dm\")
2765 means durations longer than a day will be expressed in days and
2766 minutes, and durations less than a day will be expressed entirely
2767 in minutes (even for durations longer than an hour)."
2768 :group 'org-time
2769 :type '(choice (string :tag "Format string")
2770 (set :tag "Plist"
2771 (group :inline t (const :tag "Years" :years)
2772 (string :tag "Format string"))
2773 (group :inline t
2774 (const :tag "Always show years" :require-years)
2775 (const t))
2776 (group :inline t (const :tag "Months" :months)
2777 (string :tag "Format string"))
2778 (group :inline t
2779 (const :tag "Always show months" :require-months)
2780 (const t))
2781 (group :inline t (const :tag "Weeks" :weeks)
2782 (string :tag "Format string"))
2783 (group :inline t
2784 (const :tag "Always show weeks" :require-weeks)
2785 (const t))
2786 (group :inline t (const :tag "Days" :days)
2787 (string :tag "Format string"))
2788 (group :inline t
2789 (const :tag "Always show days" :require-days)
2790 (const t))
2791 (group :inline t (const :tag "Hours" :hours)
2792 (string :tag "Format string"))
2793 (group :inline t
2794 (const :tag "Always show hours" :require-hours)
2795 (const t))
2796 (group :inline t (const :tag "Minutes" :minutes)
2797 (string :tag "Format string"))
2798 (group :inline t
2799 (const :tag "Always show minutes" :require-minutes)
2800 (const t)))))
2802 (defcustom org-time-clocksum-use-fractional nil
2803 "If non-nil, \\[org-clock-display] uses fractional times.
2804 org-mode generates a time duration."
2805 :group 'org-time
2806 :type 'boolean)
2808 (defcustom org-time-clocksum-fractional-format "%.2f"
2809 "The format string used when creating CLOCKSUM lines,
2810 or when Org mode generates a time duration, if
2811 `org-time-clocksum-use-fractional' is enabled.
2813 The value can be a single format string containing one
2814 %-sequence, which will be filled with the number of hours as
2815 a float.
2817 Alternatively, the value can be a plist associating any of the
2818 keys :years, :months, :weeks, :days, :hours or :minutes with
2819 a format string. The time duration is formatted using the
2820 largest time unit which gives a non-zero integer part. If all
2821 specified formats have zero integer part, the smallest time unit
2822 is used."
2823 :group 'org-time
2824 :type '(choice (string :tag "Format string")
2825 (set (group :inline t (const :tag "Years" :years)
2826 (string :tag "Format string"))
2827 (group :inline t (const :tag "Months" :months)
2828 (string :tag "Format string"))
2829 (group :inline t (const :tag "Weeks" :weeks)
2830 (string :tag "Format string"))
2831 (group :inline t (const :tag "Days" :days)
2832 (string :tag "Format string"))
2833 (group :inline t (const :tag "Hours" :hours)
2834 (string :tag "Format string"))
2835 (group :inline t (const :tag "Minutes" :minutes)
2836 (string :tag "Format string")))))
2838 (defcustom org-deadline-warning-days 14
2839 "No. of days before expiration during which a deadline becomes active.
2840 This variable governs the display in sparse trees and in the agenda.
2841 When 0 or negative, it means use this number (the absolute value of it)
2842 even if a deadline has a different individual lead time specified.
2844 Custom commands can set this variable in the options section."
2845 :group 'org-time
2846 :group 'org-agenda-daily/weekly
2847 :type 'integer)
2849 (defcustom org-read-date-prefer-future t
2850 "Non-nil means assume future for incomplete date input from user.
2851 This affects the following situations:
2852 1. The user gives a month but not a year.
2853 For example, if it is April and you enter \"feb 2\", this will be read
2854 as Feb 2, *next* year. \"May 5\", however, will be this year.
2855 2. The user gives a day, but no month.
2856 For example, if today is the 15th, and you enter \"3\", Org-mode will
2857 read this as the third of *next* month. However, if you enter \"17\",
2858 it will be considered as *this* month.
2860 If you set this variable to the symbol `time', then also the following
2861 will work:
2863 3. If the user gives a time.
2864 If the time is before now, it will be interpreted as tomorrow.
2866 Currently none of this works for ISO week specifications.
2868 When this option is nil, the current day, month and year will always be
2869 used as defaults.
2871 See also `org-agenda-jump-prefer-future'."
2872 :group 'org-time
2873 :type '(choice
2874 (const :tag "Never" nil)
2875 (const :tag "Check month and day" t)
2876 (const :tag "Check month, day, and time" time)))
2878 (defcustom org-agenda-jump-prefer-future 'org-read-date-prefer-future
2879 "Should the agenda jump command prefer the future for incomplete dates?
2880 The default is to do the same as configured in `org-read-date-prefer-future'.
2881 But you can also set a deviating value here.
2882 This may t or nil, or the symbol `org-read-date-prefer-future'."
2883 :group 'org-agenda
2884 :group 'org-time
2885 :version "24.1"
2886 :type '(choice
2887 (const :tag "Use org-read-date-prefer-future"
2888 org-read-date-prefer-future)
2889 (const :tag "Never" nil)
2890 (const :tag "Always" t)))
2892 (defcustom org-read-date-force-compatible-dates t
2893 "Should date/time prompt force dates that are guaranteed to work in Emacs?
2895 Depending on the system Emacs is running on, certain dates cannot
2896 be represented with the type used internally to represent time.
2897 Dates between 1970-1-1 and 2038-1-1 can always be represented
2898 correctly. Some systems allow for earlier dates, some for later,
2899 some for both. One way to find out it to insert any date into an
2900 Org buffer, putting the cursor on the year and hitting S-up and
2901 S-down to test the range.
2903 When this variable is set to t, the date/time prompt will not let
2904 you specify dates outside the 1970-2037 range, so it is certain that
2905 these dates will work in whatever version of Emacs you are
2906 running, and also that you can move a file from one Emacs implementation
2907 to another. WHenever Org is forcing the year for you, it will display
2908 a message and beep.
2910 When this variable is nil, Org will check if the date is
2911 representable in the specific Emacs implementation you are using.
2912 If not, it will force a year, usually the current year, and beep
2913 to remind you. Currently this setting is not recommended because
2914 the likelihood that you will open your Org files in an Emacs that
2915 has limited date range is not negligible.
2917 A workaround for this problem is to use diary sexp dates for time
2918 stamps outside of this range."
2919 :group 'org-time
2920 :version "24.1"
2921 :type 'boolean)
2923 (defcustom org-read-date-display-live t
2924 "Non-nil means display current interpretation of date prompt live.
2925 This display will be in an overlay, in the minibuffer."
2926 :group 'org-time
2927 :type 'boolean)
2929 (defcustom org-read-date-popup-calendar t
2930 "Non-nil means pop up a calendar when prompting for a date.
2931 In the calendar, the date can be selected with mouse-1. However, the
2932 minibuffer will also be active, and you can simply enter the date as well.
2933 When nil, only the minibuffer will be available."
2934 :group 'org-time
2935 :type 'boolean)
2936 (if (fboundp 'defvaralias)
2937 (defvaralias 'org-popup-calendar-for-date-prompt
2938 'org-read-date-popup-calendar))
2940 (defcustom org-read-date-minibuffer-setup-hook nil
2941 "Hook to be used to set up keys for the date/time interface.
2942 Add key definitions to `minibuffer-local-map', which will be a temporary
2943 copy."
2944 :group 'org-time
2945 :type 'hook)
2947 (defcustom org-extend-today-until 0
2948 "The hour when your day really ends. Must be an integer.
2949 This has influence for the following applications:
2950 - When switching the agenda to \"today\". It it is still earlier than
2951 the time given here, the day recognized as TODAY is actually yesterday.
2952 - When a date is read from the user and it is still before the time given
2953 here, the current date and time will be assumed to be yesterday, 23:59.
2954 Also, timestamps inserted in capture templates follow this rule.
2956 IMPORTANT: This is a feature whose implementation is and likely will
2957 remain incomplete. Really, it is only here because past midnight seems to
2958 be the favorite working time of John Wiegley :-)"
2959 :group 'org-time
2960 :type 'integer)
2962 (defcustom org-use-effective-time nil
2963 "If non-nil, consider `org-extend-today-until' when creating timestamps.
2964 For example, if `org-extend-today-until' is 8, and it's 4am, then the
2965 \"effective time\" of any timestamps between midnight and 8am will be
2966 23:59 of the previous day."
2967 :group 'org-time
2968 :version "24.1"
2969 :type 'boolean)
2971 (defcustom org-use-last-clock-out-time-as-effective-time nil
2972 "When non-nil, use the last clock out time for `org-todo'.
2973 Note that this option has precedence over the combined use of
2974 `org-use-effective-time' and `org-extend-today-until'."
2975 :group 'org-time
2976 ;; :version "24.3"
2977 :type 'boolean)
2979 (defcustom org-edit-timestamp-down-means-later nil
2980 "Non-nil means S-down will increase the time in a time stamp.
2981 When nil, S-up will increase."
2982 :group 'org-time
2983 :type 'boolean)
2985 (defcustom org-calendar-follow-timestamp-change t
2986 "Non-nil means make the calendar window follow timestamp changes.
2987 When a timestamp is modified and the calendar window is visible, it will be
2988 moved to the new date."
2989 :group 'org-time
2990 :type 'boolean)
2992 (defgroup org-tags nil
2993 "Options concerning tags in Org-mode."
2994 :tag "Org Tags"
2995 :group 'org)
2997 (defcustom org-tag-alist nil
2998 "List of tags allowed in Org-mode files.
2999 When this list is nil, Org-mode will base TAG input on what is already in the
3000 buffer.
3001 The value of this variable is an alist, the car of each entry must be a
3002 keyword as a string, the cdr may be a character that is used to select
3003 that tag through the fast-tag-selection interface.
3004 See the manual for details."
3005 :group 'org-tags
3006 :type '(repeat
3007 (choice
3008 (cons (string :tag "Tag name")
3009 (character :tag "Access char"))
3010 (list :tag "Start radio group"
3011 (const :startgroup)
3012 (option (string :tag "Group description")))
3013 (list :tag "End radio group"
3014 (const :endgroup)
3015 (option (string :tag "Group description")))
3016 (const :tag "New line" (:newline)))))
3018 (defcustom org-tag-persistent-alist nil
3019 "List of tags that will always appear in all Org-mode files.
3020 This is in addition to any in buffer settings or customizations
3021 of `org-tag-alist'.
3022 When this list is nil, Org-mode will base TAG input on `org-tag-alist'.
3023 The value of this variable is an alist, the car of each entry must be a
3024 keyword as a string, the cdr may be a character that is used to select
3025 that tag through the fast-tag-selection interface.
3026 See the manual for details.
3027 To disable these tags on a per-file basis, insert anywhere in the file:
3028 #+STARTUP: noptag"
3029 :group 'org-tags
3030 :type '(repeat
3031 (choice
3032 (cons (string :tag "Tag name")
3033 (character :tag "Access char"))
3034 (const :tag "Start radio group" (:startgroup))
3035 (const :tag "End radio group" (:endgroup))
3036 (const :tag "New line" (:newline)))))
3038 (defcustom org-complete-tags-always-offer-all-agenda-tags nil
3039 "If non-nil, always offer completion for all tags of all agenda files.
3040 Instead of customizing this variable directly, you might want to
3041 set it locally for capture buffers, because there no list of
3042 tags in that file can be created dynamically (there are none).
3044 (add-hook 'org-capture-mode-hook
3045 (lambda ()
3046 (set (make-local-variable
3047 'org-complete-tags-always-offer-all-agenda-tags)
3048 t)))"
3049 :group 'org-tags
3050 :version "24.1"
3051 :type 'boolean)
3053 (defvar org-file-tags nil
3054 "List of tags that can be inherited by all entries in the file.
3055 The tags will be inherited if the variable `org-use-tag-inheritance'
3056 says they should be.
3057 This variable is populated from #+FILETAGS lines.")
3059 (defcustom org-use-fast-tag-selection 'auto
3060 "Non-nil means use fast tag selection scheme.
3061 This is a special interface to select and deselect tags with single keys.
3062 When nil, fast selection is never used.
3063 When the symbol `auto', fast selection is used if and only if selection
3064 characters for tags have been configured, either through the variable
3065 `org-tag-alist' or through a #+TAGS line in the buffer.
3066 When t, fast selection is always used and selection keys are assigned
3067 automatically if necessary."
3068 :group 'org-tags
3069 :type '(choice
3070 (const :tag "Always" t)
3071 (const :tag "Never" nil)
3072 (const :tag "When selection characters are configured" 'auto)))
3074 (defcustom org-fast-tag-selection-single-key nil
3075 "Non-nil means fast tag selection exits after first change.
3076 When nil, you have to press RET to exit it.
3077 During fast tag selection, you can toggle this flag with `C-c'.
3078 This variable can also have the value `expert'. In this case, the window
3079 displaying the tags menu is not even shown, until you press C-c again."
3080 :group 'org-tags
3081 :type '(choice
3082 (const :tag "No" nil)
3083 (const :tag "Yes" t)
3084 (const :tag "Expert" expert)))
3086 (defvar org-fast-tag-selection-include-todo nil
3087 "Non-nil means fast tags selection interface will also offer TODO states.
3088 This is an undocumented feature, you should not rely on it.")
3090 (defcustom org-tags-column (if (featurep 'xemacs) -76 -77)
3091 "The column to which tags should be indented in a headline.
3092 If this number is positive, it specifies the column. If it is negative,
3093 it means that the tags should be flushright to that column. For example,
3094 -80 works well for a normal 80 character screen.
3095 When 0, place tags directly after headline text, with only one space in
3096 between."
3097 :group 'org-tags
3098 :type 'integer)
3100 (defcustom org-auto-align-tags t
3101 "Non-nil keeps tags aligned when modifying headlines.
3102 Some operations (i.e. demoting) change the length of a headline and
3103 therefore shift the tags around. With this option turned on, after
3104 each such operation the tags are again aligned to `org-tags-column'."
3105 :group 'org-tags
3106 :type 'boolean)
3108 (defcustom org-use-tag-inheritance t
3109 "Non-nil means tags in levels apply also for sublevels.
3110 When nil, only the tags directly given in a specific line apply there.
3111 This may also be a list of tags that should be inherited, or a regexp that
3112 matches tags that should be inherited. Additional control is possible
3113 with the variable `org-tags-exclude-from-inheritance' which gives an
3114 explicit list of tags to be excluded from inheritance., even if the value of
3115 `org-use-tag-inheritance' would select it for inheritance.
3117 If this option is t, a match early-on in a tree can lead to a large
3118 number of matches in the subtree when constructing the agenda or creating
3119 a sparse tree. If you only want to see the first match in a tree during
3120 a search, check out the variable `org-tags-match-list-sublevels'."
3121 :group 'org-tags
3122 :type '(choice
3123 (const :tag "Not" nil)
3124 (const :tag "Always" t)
3125 (repeat :tag "Specific tags" (string :tag "Tag"))
3126 (regexp :tag "Tags matched by regexp")))
3128 (defcustom org-tags-exclude-from-inheritance nil
3129 "List of tags that should never be inherited.
3130 This is a way to exclude a few tags from inheritance. For way to do
3131 the opposite, to actively allow inheritance for selected tags,
3132 see the variable `org-use-tag-inheritance'."
3133 :group 'org-tags
3134 :type '(repeat (string :tag "Tag")))
3136 (defun org-tag-inherit-p (tag)
3137 "Check if TAG is one that should be inherited."
3138 (cond
3139 ((member tag org-tags-exclude-from-inheritance) nil)
3140 ((eq org-use-tag-inheritance t) t)
3141 ((not org-use-tag-inheritance) nil)
3142 ((stringp org-use-tag-inheritance)
3143 (string-match org-use-tag-inheritance tag))
3144 ((listp org-use-tag-inheritance)
3145 (member tag org-use-tag-inheritance))
3146 (t (error "Invalid setting of `org-use-tag-inheritance'"))))
3148 (defcustom org-tags-match-list-sublevels t
3149 "Non-nil means list also sublevels of headlines matching a search.
3150 This variable applies to tags/property searches, and also to stuck
3151 projects because this search is based on a tags match as well.
3153 When set to the symbol `indented', sublevels are indented with
3154 leading dots.
3156 Because of tag inheritance (see variable `org-use-tag-inheritance'),
3157 the sublevels of a headline matching a tag search often also match
3158 the same search. Listing all of them can create very long lists.
3159 Setting this variable to nil causes subtrees of a match to be skipped.
3161 This variable is semi-obsolete and probably should always be true. It
3162 is better to limit inheritance to certain tags using the variables
3163 `org-use-tag-inheritance' and `org-tags-exclude-from-inheritance'."
3164 :group 'org-tags
3165 :type '(choice
3166 (const :tag "No, don't list them" nil)
3167 (const :tag "Yes, do list them" t)
3168 (const :tag "List them, indented with leading dots" indented)))
3170 (defcustom org-tags-sort-function nil
3171 "When set, tags are sorted using this function as a comparator."
3172 :group 'org-tags
3173 :type '(choice
3174 (const :tag "No sorting" nil)
3175 (const :tag "Alphabetical" string<)
3176 (const :tag "Reverse alphabetical" string>)
3177 (function :tag "Custom function" nil)))
3179 (defvar org-tags-history nil
3180 "History of minibuffer reads for tags.")
3181 (defvar org-last-tags-completion-table nil
3182 "The last used completion table for tags.")
3183 (defvar org-after-tags-change-hook nil
3184 "Hook that is run after the tags in a line have changed.")
3186 (defgroup org-properties nil
3187 "Options concerning properties in Org-mode."
3188 :tag "Org Properties"
3189 :group 'org)
3191 (defcustom org-property-format "%-10s %s"
3192 "How property key/value pairs should be formatted by `indent-line'.
3193 When `indent-line' hits a property definition, it will format the line
3194 according to this format, mainly to make sure that the values are
3195 lined-up with respect to each other."
3196 :group 'org-properties
3197 :type 'string)
3199 (defcustom org-properties-postprocess-alist nil
3200 "Alist of properties and functions to adjust inserted values.
3201 Elements of this alist must be of the form
3203 ([string] [function])
3205 where [string] must be a property name and [function] must be a
3206 lambda expression: this lambda expression must take one argument,
3207 the value to adjust, and return the new value as a string.
3209 For example, this element will allow the property \"Remaining\"
3210 to be updated wrt the relation between the \"Effort\" property
3211 and the clock summary:
3213 ((\"Remaining\" (lambda(value)
3214 (let ((clocksum (org-clock-sum-current-item))
3215 (effort (org-duration-string-to-minutes
3216 (org-entry-get (point) \"Effort\"))))
3217 (org-minutes-to-clocksum-string (- effort clocksum))))))"
3218 :group 'org-properties
3219 :version "24.1"
3220 :type '(alist :key-type (string :tag "Property")
3221 :value-type (function :tag "Function")))
3223 (defcustom org-use-property-inheritance nil
3224 "Non-nil means properties apply also for sublevels.
3226 This setting is chiefly used during property searches. Turning it on can
3227 cause significant overhead when doing a search, which is why it is not
3228 on by default.
3230 When nil, only the properties directly given in the current entry count.
3231 When t, every property is inherited. The value may also be a list of
3232 properties that should have inheritance, or a regular expression matching
3233 properties that should be inherited.
3235 However, note that some special properties use inheritance under special
3236 circumstances (not in searches). Examples are CATEGORY, ARCHIVE, COLUMNS,
3237 and the properties ending in \"_ALL\" when they are used as descriptor
3238 for valid values of a property.
3240 Note for programmers:
3241 When querying an entry with `org-entry-get', you can control if inheritance
3242 should be used. By default, `org-entry-get' looks only at the local
3243 properties. You can request inheritance by setting the inherit argument
3244 to t (to force inheritance) or to `selective' (to respect the setting
3245 in this variable)."
3246 :group 'org-properties
3247 :type '(choice
3248 (const :tag "Not" nil)
3249 (const :tag "Always" t)
3250 (repeat :tag "Specific properties" (string :tag "Property"))
3251 (regexp :tag "Properties matched by regexp")))
3253 (defun org-property-inherit-p (property)
3254 "Check if PROPERTY is one that should be inherited."
3255 (cond
3256 ((eq org-use-property-inheritance t) t)
3257 ((not org-use-property-inheritance) nil)
3258 ((stringp org-use-property-inheritance)
3259 (string-match org-use-property-inheritance property))
3260 ((listp org-use-property-inheritance)
3261 (member property org-use-property-inheritance))
3262 (t (error "Invalid setting of `org-use-property-inheritance'"))))
3264 (defcustom org-columns-default-format "%25ITEM %TODO %3PRIORITY %TAGS"
3265 "The default column format, if no other format has been defined.
3266 This variable can be set on the per-file basis by inserting a line
3268 #+COLUMNS: %25ITEM ....."
3269 :group 'org-properties
3270 :type 'string)
3272 (defcustom org-columns-ellipses ".."
3273 "The ellipses to be used when a field in column view is truncated.
3274 When this is the empty string, as many characters as possible are shown,
3275 but then there will be no visual indication that the field has been truncated.
3276 When this is a string of length N, the last N characters of a truncated
3277 field are replaced by this string. If the column is narrower than the
3278 ellipses string, only part of the ellipses string will be shown."
3279 :group 'org-properties
3280 :type 'string)
3282 (defcustom org-columns-modify-value-for-display-function nil
3283 "Function that modifies values for display in column view.
3284 For example, it can be used to cut out a certain part from a time stamp.
3285 The function must take 2 arguments:
3287 column-title The title of the column (*not* the property name)
3288 value The value that should be modified.
3290 The function should return the value that should be displayed,
3291 or nil if the normal value should be used."
3292 :group 'org-properties
3293 :type 'function)
3295 (defcustom org-effort-property "Effort"
3296 "The property that is being used to keep track of effort estimates.
3297 Effort estimates given in this property need to have the format H:MM."
3298 :group 'org-properties
3299 :group 'org-progress
3300 :type '(string :tag "Property"))
3302 (defconst org-global-properties-fixed
3303 '(("VISIBILITY_ALL" . "folded children content all")
3304 ("CLOCK_MODELINE_TOTAL_ALL" . "current today repeat all auto"))
3305 "List of property/value pairs that can be inherited by any entry.
3307 These are fixed values, for the preset properties. The user variable
3308 that can be used to add to this list is `org-global-properties'.
3310 The entries in this list are cons cells where the car is a property
3311 name and cdr is a string with the value. If the value represents
3312 multiple items like an \"_ALL\" property, separate the items by
3313 spaces.")
3315 (defcustom org-global-properties nil
3316 "List of property/value pairs that can be inherited by any entry.
3318 This list will be combined with the constant `org-global-properties-fixed'.
3320 The entries in this list are cons cells where the car is a property
3321 name and cdr is a string with the value.
3323 You can set buffer-local values for the same purpose in the variable
3324 `org-file-properties' this by adding lines like
3327 :group 'org-properties
3328 :type '(repeat
3329 (cons (string :tag "Property")
3330 (string :tag "Value"))))
3332 (defvar org-file-properties nil
3333 "List of property/value pairs that can be inherited by any entry.
3334 Valid for the current buffer.
3335 This variable is populated from #+PROPERTY lines.")
3336 (make-variable-buffer-local 'org-file-properties)
3338 (defgroup org-agenda nil
3339 "Options concerning agenda views in Org-mode."
3340 :tag "Org Agenda"
3341 :group 'org)
3343 (defvar org-category nil
3344 "Variable used by org files to set a category for agenda display.
3345 Such files should use a file variable to set it, for example
3347 # -*- mode: org; org-category: \"ELisp\"
3349 or contain a special line
3351 #+CATEGORY: ELisp
3353 If the file does not specify a category, then file's base name
3354 is used instead.")
3355 (make-variable-buffer-local 'org-category)
3356 (put 'org-category 'safe-local-variable #'(lambda (x) (or (symbolp x) (stringp x))))
3358 (defcustom org-agenda-files nil
3359 "The files to be used for agenda display.
3360 Entries may be added to this list with \\[org-agenda-file-to-front] and removed with
3361 \\[org-remove-file]. You can also use customize to edit the list.
3363 If an entry is a directory, all files in that directory that are matched by
3364 `org-agenda-file-regexp' will be part of the file list.
3366 If the value of the variable is not a list but a single file name, then
3367 the list of agenda files is actually stored and maintained in that file, one
3368 agenda file per line. In this file paths can be given relative to
3369 `org-directory'. Tilde expansion and environment variable substitution
3370 are also made."
3371 :group 'org-agenda
3372 :type '(choice
3373 (repeat :tag "List of files and directories" file)
3374 (file :tag "Store list in a file\n" :value "~/.agenda_files")))
3376 (defcustom org-agenda-file-regexp "\\`[^.].*\\.org\\'"
3377 "Regular expression to match files for `org-agenda-files'.
3378 If any element in the list in that variable contains a directory instead
3379 of a normal file, all files in that directory that are matched by this
3380 regular expression will be included."
3381 :group 'org-agenda
3382 :type 'regexp)
3384 (defcustom org-agenda-text-search-extra-files nil
3385 "List of extra files to be searched by text search commands.
3386 These files will be search in addition to the agenda files by the
3387 commands `org-search-view' (`C-c a s') and `org-occur-in-agenda-files'.
3388 Note that these files will only be searched for text search commands,
3389 not for the other agenda views like todo lists, tag searches or the weekly
3390 agenda. This variable is intended to list notes and possibly archive files
3391 that should also be searched by these two commands.
3392 In fact, if the first element in the list is the symbol `agenda-archives',
3393 than all archive files of all agenda files will be added to the search
3394 scope."
3395 :group 'org-agenda
3396 :type '(set :greedy t
3397 (const :tag "Agenda Archives" agenda-archives)
3398 (repeat :inline t (file))))
3400 (if (fboundp 'defvaralias)
3401 (defvaralias 'org-agenda-multi-occur-extra-files
3402 'org-agenda-text-search-extra-files))
3404 (defcustom org-agenda-skip-unavailable-files nil
3405 "Non-nil means to just skip non-reachable files in `org-agenda-files'.
3406 A nil value means to remove them, after a query, from the list."
3407 :group 'org-agenda
3408 :type 'boolean)
3410 (defcustom org-calendar-to-agenda-key [?c]
3411 "The key to be installed in `calendar-mode-map' for switching to the agenda.
3412 The command `org-calendar-goto-agenda' will be bound to this key. The
3413 default is the character `c' because then `c' can be used to switch back and
3414 forth between agenda and calendar."
3415 :group 'org-agenda
3416 :type 'sexp)
3418 (defcustom org-calendar-insert-diary-entry-key [?i]
3419 "The key to be installed in `calendar-mode-map' for adding diary entries.
3420 This option is irrelevant until `org-agenda-diary-file' has been configured
3421 to point to an Org-mode file. When that is the case, the command
3422 `org-agenda-diary-entry' will be bound to the key given here, by default
3423 `i'. In the calendar, `i' normally adds entries to `diary-file'. So
3424 if you want to continue doing this, you need to change this to a different
3425 key."
3426 :group 'org-agenda
3427 :type 'sexp)
3429 (defcustom org-agenda-diary-file 'diary-file
3430 "File to which to add new entries with the `i' key in agenda and calendar.
3431 When this is the symbol `diary-file', the functionality in the Emacs
3432 calendar will be used to add entries to the `diary-file'. But when this
3433 points to a file, `org-agenda-diary-entry' will be used instead."
3434 :group 'org-agenda
3435 :type '(choice
3436 (const :tag "The standard Emacs diary file" diary-file)
3437 (file :tag "Special Org file diary entries")))
3439 (eval-after-load "calendar"
3440 '(progn
3441 (org-defkey calendar-mode-map org-calendar-to-agenda-key
3442 'org-calendar-goto-agenda)
3443 (add-hook 'calendar-mode-hook
3444 (lambda ()
3445 (unless (eq org-agenda-diary-file 'diary-file)
3446 (define-key calendar-mode-map
3447 org-calendar-insert-diary-entry-key
3448 'org-agenda-diary-entry))))))
3450 (defgroup org-latex nil
3451 "Options for embedding LaTeX code into Org-mode."
3452 :tag "Org LaTeX"
3453 :group 'org)
3455 (defcustom org-format-latex-options
3456 '(:foreground default :background default :scale 1.0
3457 :html-foreground "Black" :html-background "Transparent"
3458 :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))
3459 "Options for creating images from LaTeX fragments.
3460 This is a property list with the following properties:
3461 :foreground the foreground color for images embedded in Emacs, e.g. \"Black\".
3462 `default' means use the foreground of the default face.
3463 `auto' means use the foreground from the text face.
3464 :background the background color, or \"Transparent\".
3465 `default' means use the background of the default face.
3466 `auto' means use the background from the text face.
3467 :scale a scaling factor for the size of the images, to get more pixels
3468 :html-foreground, :html-background, :html-scale
3469 the same numbers for HTML export.
3470 :matchers a list indicating which matchers should be used to
3471 find LaTeX fragments. Valid members of this list are:
3472 \"begin\" find environments
3473 \"$1\" find single characters surrounded by $.$
3474 \"$\" find math expressions surrounded by $...$
3475 \"$$\" find math expressions surrounded by $$....$$
3476 \"\\(\" find math expressions surrounded by \\(...\\)
3477 \"\\ [\" find math expressions surrounded by \\ [...\\]"
3478 :group 'org-latex
3479 :type 'plist)
3481 (defcustom org-format-latex-signal-error t
3482 "Non-nil means signal an error when image creation of LaTeX snippets fails.
3483 When nil, just push out a message."
3484 :group 'org-latex
3485 :version "24.1"
3486 :type 'boolean)
3488 (defcustom org-latex-to-mathml-jar-file nil
3489 "Value of\"%j\" in `org-latex-to-mathml-convert-command'.
3490 Use this to specify additional executable file say a jar file.
3492 When using MathToWeb as the converter, specify the full-path to
3493 your mathtoweb.jar file."
3494 :group 'org-latex
3495 :version "24.1"
3496 :type '(choice
3497 (const :tag "None" nil)
3498 (file :tag "JAR file" :must-match t)))
3500 (defcustom org-latex-to-mathml-convert-command nil
3501 "Command to convert LaTeX fragments to MathML.
3502 Replace format-specifiers in the command as noted below and use
3503 `shell-command' to convert LaTeX to MathML.
3504 %j: Executable file in fully expanded form as specified by
3505 `org-latex-to-mathml-jar-file'.
3506 %I: Input LaTeX file in fully expanded form
3507 %o: Output MathML file
3508 This command is used by `org-create-math-formula'.
3510 When using MathToWeb as the converter, set this to
3511 \"java -jar %j -unicode -force -df %o %I\"."
3512 :group 'org-latex
3513 :version "24.1"
3514 :type '(choice
3515 (const :tag "None" nil)
3516 (string :tag "\nShell command")))
3518 (defcustom org-latex-create-formula-image-program 'dvipng
3519 "Program to convert LaTeX fragments with.
3521 dvipng Process the LaTeX fragments to dvi file, then convert
3522 dvi files to png files using dvipng.
3523 This will also include processing of non-math environments.
3524 imagemagick Convert the LaTeX fragments to pdf files and use imagemagick
3525 to convert pdf files to png files"
3526 :group 'org-latex
3527 :version "24.1"
3528 :type '(choice
3529 (const :tag "dvipng" dvipng)
3530 (const :tag "imagemagick" imagemagick)))
3532 (defcustom org-latex-preview-ltxpng-directory "ltxpng/"
3533 "Path to store latex preview images.
3534 A relative path here creates many directories relative to the
3535 processed org files paths. An absolute path puts all preview
3536 images at the same place."
3537 :group 'org-latex
3538 :version "24.3"
3539 :type 'string)
3541 (defun org-format-latex-mathml-available-p ()
3542 "Return t if `org-latex-to-mathml-convert-command' is usable."
3543 (save-match-data
3544 (when (and (boundp 'org-latex-to-mathml-convert-command)
3545 org-latex-to-mathml-convert-command)
3546 (let ((executable (car (split-string
3547 org-latex-to-mathml-convert-command))))
3548 (when (executable-find executable)
3549 (if (string-match
3550 "%j" org-latex-to-mathml-convert-command)
3551 (file-readable-p org-latex-to-mathml-jar-file)
3552 t))))))
3554 (defcustom org-format-latex-header "\\documentclass{article}
3555 \\usepackage[usenames]{color}
3556 \\usepackage{amsmath}
3557 \\usepackage[mathscr]{eucal}
3558 \\pagestyle{empty} % do not remove
3559 \[PACKAGES]
3561 % The settings below are copied from fullpage.sty
3562 \\setlength{\\textwidth}{\\paperwidth}
3563 \\addtolength{\\textwidth}{-3cm}
3564 \\setlength{\\oddsidemargin}{1.5cm}
3565 \\addtolength{\\oddsidemargin}{-2.54cm}
3566 \\setlength{\\evensidemargin}{\\oddsidemargin}
3567 \\setlength{\\textheight}{\\paperheight}
3568 \\addtolength{\\textheight}{-\\headheight}
3569 \\addtolength{\\textheight}{-\\headsep}
3570 \\addtolength{\\textheight}{-\\footskip}
3571 \\addtolength{\\textheight}{-3cm}
3572 \\setlength{\\topmargin}{1.5cm}
3573 \\addtolength{\\topmargin}{-2.54cm}"
3574 "The document header used for processing LaTeX fragments.
3575 It is imperative that this header make sure that no page number
3576 appears on the page. The package defined in the variables
3577 `org-export-latex-default-packages-alist' and `org-export-latex-packages-alist'
3578 will either replace the placeholder \"[PACKAGES]\" in this header, or they
3579 will be appended."
3580 :group 'org-latex
3581 :type 'string)
3583 (defvar org-format-latex-header-extra nil)
3585 (defun org-set-packages-alist (var val)
3586 "Set the packages alist and make sure it has 3 elements per entry."
3587 (set var (mapcar (lambda (x)
3588 (if (and (consp x) (= (length x) 2))
3589 (list (car x) (nth 1 x) t)
3591 val)))
3593 (defun org-get-packages-alist (var)
3595 "Get the packages alist and make sure it has 3 elements per entry."
3596 (mapcar (lambda (x)
3597 (if (and (consp x) (= (length x) 2))
3598 (list (car x) (nth 1 x) t)
3600 (default-value var)))
3602 ;; The following variables are defined here because is it also used
3603 ;; when formatting latex fragments. Originally it was part of the
3604 ;; LaTeX exporter, which is why the name includes "export".
3605 (defcustom org-export-latex-default-packages-alist
3606 '(("AUTO" "inputenc" t)
3607 ("T1" "fontenc" t)
3608 ("" "fixltx2e" nil)
3609 ("" "graphicx" t)
3610 ("" "longtable" nil)
3611 ("" "float" nil)
3612 ("" "wrapfig" nil)
3613 ("" "soul" t)
3614 ("" "textcomp" t)
3615 ("" "marvosym" t)
3616 ("" "wasysym" t)
3617 ("" "latexsym" t)
3618 ("" "amssymb" t)
3619 ("" "hyperref" nil)
3620 "\\tolerance=1000"
3622 "Alist of default packages to be inserted in the header.
3623 Change this only if one of the packages here causes an incompatibility
3624 with another package you are using.
3625 The packages in this list are needed by one part or another of Org-mode
3626 to function properly.
3628 - inputenc, fontenc: for basic font and character selection
3629 - textcomp, marvosymb, wasysym, latexsym, amssym: for various symbols used
3630 for interpreting the entities in `org-entities'. You can skip some of these
3631 packages if you don't use any of the symbols in it.
3632 - graphicx: for including images
3633 - float, wrapfig: for figure placement
3634 - longtable: for long tables
3635 - hyperref: for cross references
3637 Therefore you should not modify this variable unless you know what you
3638 are doing. The one reason to change it anyway is that you might be loading
3639 some other package that conflicts with one of the default packages.
3640 Each cell is of the format \( \"options\" \"package\" snippet-flag\).
3641 If SNIPPET-FLAG is t, the package also needs to be included when
3642 compiling LaTeX snippets into images for inclusion into HTML."
3643 :group 'org-export-latex
3644 :set 'org-set-packages-alist
3645 :get 'org-get-packages-alist
3646 :version "24.1"
3647 :type '(repeat
3648 (choice
3649 (list :tag "options/package pair"
3650 (string :tag "options")
3651 (string :tag "package")
3652 (boolean :tag "Snippet"))
3653 (string :tag "A line of LaTeX"))))
3655 (defcustom org-export-latex-packages-alist nil
3656 "Alist of packages to be inserted in every LaTeX header.
3657 These will be inserted after `org-export-latex-default-packages-alist'.
3658 Each cell is of the format \( \"options\" \"package\" snippet-flag \).
3659 SNIPPET-FLAG, when t, indicates that this package is also needed when
3660 turning LaTeX snippets into images for inclusion into HTML.
3661 Make sure that you only list packages here which:
3662 - you want in every file
3663 - do not conflict with the default packages in
3664 `org-export-latex-default-packages-alist'
3665 - do not conflict with the setup in `org-format-latex-header'."
3666 :group 'org-export-latex
3667 :set 'org-set-packages-alist
3668 :get 'org-get-packages-alist
3669 :type '(repeat
3670 (choice
3671 (list :tag "options/package pair"
3672 (string :tag "options")
3673 (string :tag "package")
3674 (boolean :tag "Snippet"))
3675 (string :tag "A line of LaTeX"))))
3678 (defgroup org-appearance nil
3679 "Settings for Org-mode appearance."
3680 :tag "Org Appearance"
3681 :group 'org)
3683 (defcustom org-level-color-stars-only nil
3684 "Non-nil means fontify only the stars in each headline.
3685 When nil, the entire headline is fontified.
3686 Changing it requires restart of `font-lock-mode' to become effective
3687 also in regions already fontified."
3688 :group 'org-appearance
3689 :type 'boolean)
3691 (defcustom org-hide-leading-stars nil
3692 "Non-nil means hide the first N-1 stars in a headline.
3693 This works by using the face `org-hide' for these stars. This
3694 face is white for a light background, and black for a dark
3695 background. You may have to customize the face `org-hide' to
3696 make this work.
3697 Changing it requires restart of `font-lock-mode' to become effective
3698 also in regions already fontified.
3699 You may also set this on a per-file basis by adding one of the following
3700 lines to the buffer:
3702 #+STARTUP: hidestars
3703 #+STARTUP: showstars"
3704 :group 'org-appearance
3705 :type 'boolean)
3707 (defcustom org-hidden-keywords nil
3708 "List of symbols corresponding to keywords to be hidden the org buffer.
3709 For example, a value '(title) for this list will make the document's title
3710 appear in the buffer without the initial #+TITLE: keyword."
3711 :group 'org-appearance
3712 :version "24.1"
3713 :type '(set (const :tag "#+AUTHOR" author)
3714 (const :tag "#+DATE" date)
3715 (const :tag "#+EMAIL" email)
3716 (const :tag "#+TITLE" title)))
3718 (defcustom org-custom-properties nil
3719 "List of properties (as strings) with a special meaning.
3720 The default use of these custom properties is to let the user
3721 hide them with `org-toggle-custom-properties-visibility'."
3722 :group 'org-properties
3723 :group 'org-appearance
3724 :version "24.3"
3725 :type '(repeat (string :tag "Property Name")))
3727 (defcustom org-fontify-done-headline nil
3728 "Non-nil means change the face of a headline if it is marked DONE.
3729 Normally, only the TODO/DONE keyword indicates the state of a headline.
3730 When this is non-nil, the headline after the keyword is set to the
3731 `org-headline-done' as an additional indication."
3732 :group 'org-appearance
3733 :type 'boolean)
3735 (defcustom org-fontify-emphasized-text t
3736 "Non-nil means fontify *bold*, /italic/ and _underlined_ text.
3737 Changing this variable requires a restart of Emacs to take effect."
3738 :group 'org-appearance
3739 :type 'boolean)
3741 (defcustom org-fontify-whole-heading-line nil
3742 "Non-nil means fontify the whole line for headings.
3743 This is useful when setting a background color for the
3744 org-level-* faces."
3745 :group 'org-appearance
3746 :type 'boolean)
3748 (defcustom org-highlight-latex-fragments-and-specials nil
3749 "Non-nil means fontify what is treated specially by the exporters."
3750 :group 'org-appearance
3751 :type 'boolean)
3753 (defcustom org-hide-emphasis-markers nil
3754 "Non-nil mean font-lock should hide the emphasis marker characters."
3755 :group 'org-appearance
3756 :type 'boolean)
3758 (defcustom org-pretty-entities nil
3759 "Non-nil means show entities as UTF8 characters.
3760 When nil, the \\name form remains in the buffer."
3761 :group 'org-appearance
3762 :version "24.1"
3763 :type 'boolean)
3765 (defcustom org-pretty-entities-include-sub-superscripts t
3766 "Non-nil means, pretty entity display includes formatting sub/superscripts."
3767 :group 'org-appearance
3768 :version "24.1"
3769 :type 'boolean)
3771 (defvar org-emph-re nil
3772 "Regular expression for matching emphasis.
3773 After a match, the match groups contain these elements:
3774 0 The match of the full regular expression, including the characters
3775 before and after the proper match
3776 1 The character before the proper match, or empty at beginning of line
3777 2 The proper match, including the leading and trailing markers
3778 3 The leading marker like * or /, indicating the type of highlighting
3779 4 The text between the emphasis markers, not including the markers
3780 5 The character after the match, empty at the end of a line")
3781 (defvar org-verbatim-re nil
3782 "Regular expression for matching verbatim text.")
3783 (defvar org-emphasis-regexp-components) ; defined just below
3784 (defvar org-emphasis-alist) ; defined just below
3785 (defun org-set-emph-re (var val)
3786 "Set variable and compute the emphasis regular expression."
3787 (set var val)
3788 (when (and (boundp 'org-emphasis-alist)
3789 (boundp 'org-emphasis-regexp-components)
3790 org-emphasis-alist org-emphasis-regexp-components)
3791 (let* ((e org-emphasis-regexp-components)
3792 (pre (car e))
3793 (post (nth 1 e))
3794 (border (nth 2 e))
3795 (body (nth 3 e))
3796 (nl (nth 4 e))
3797 (body1 (concat body "*?"))
3798 (markers (mapconcat 'car org-emphasis-alist ""))
3799 (vmarkers (mapconcat
3800 (lambda (x) (if (eq (nth 4 x) 'verbatim) (car x) ""))
3801 org-emphasis-alist "")))
3802 ;; make sure special characters appear at the right position in the class
3803 (if (string-match "\\^" markers)
3804 (setq markers (concat (replace-match "" t t markers) "^")))
3805 (if (string-match "-" markers)
3806 (setq markers (concat (replace-match "" t t markers) "-")))
3807 (if (string-match "\\^" vmarkers)
3808 (setq vmarkers (concat (replace-match "" t t vmarkers) "^")))
3809 (if (string-match "-" vmarkers)
3810 (setq vmarkers (concat (replace-match "" t t vmarkers) "-")))
3811 (if (> nl 0)
3812 (setq body1 (concat body1 "\\(?:\n" body "*?\\)\\{0,"
3813 (int-to-string nl) "\\}")))
3814 ;; Make the regexp
3815 (setq org-emph-re
3816 (concat "\\([" pre "]\\|^\\)"
3817 "\\("
3818 "\\([" markers "]\\)"
3819 "\\("
3820 "[^" border "]\\|"
3821 "[^" border "]"
3822 body1
3823 "[^" border "]"
3824 "\\)"
3825 "\\3\\)"
3826 "\\([" post "]\\|$\\)"))
3827 (setq org-verbatim-re
3828 (concat "\\([" pre "]\\|^\\)"
3829 "\\("
3830 "\\([" vmarkers "]\\)"
3831 "\\("
3832 "[^" border "]\\|"
3833 "[^" border "]"
3834 body1
3835 "[^" border "]"
3836 "\\)"
3837 "\\3\\)"
3838 "\\([" post "]\\|$\\)")))))
3840 (defcustom org-emphasis-regexp-components
3841 '(" \t('\"{" "- \t.,:!?;'\")}\\" " \t\r\n,\"'" "." 1)
3842 "Components used to build the regular expression for emphasis.
3843 This is a list with five entries. Terminology: In an emphasis string
3844 like \" *strong word* \", we call the initial space PREMATCH, the final
3845 space POSTMATCH, the stars MARKERS, \"s\" and \"d\" are BORDER characters
3846 and \"trong wor\" is the body. The different components in this variable
3847 specify what is allowed/forbidden in each part:
3849 pre Chars allowed as prematch. Beginning of line will be allowed too.
3850 post Chars allowed as postmatch. End of line will be allowed too.
3851 border The chars *forbidden* as border characters.
3852 body-regexp A regexp like \".\" to match a body character. Don't use
3853 non-shy groups here, and don't allow newline here.
3854 newline The maximum number of newlines allowed in an emphasis exp.
3856 Use customize to modify this, or restart Emacs after changing it."
3857 :group 'org-appearance
3858 :set 'org-set-emph-re
3859 :type '(list
3860 (sexp :tag "Allowed chars in pre ")
3861 (sexp :tag "Allowed chars in post ")
3862 (sexp :tag "Forbidden chars in border ")
3863 (sexp :tag "Regexp for body ")
3864 (integer :tag "number of newlines allowed")
3865 (option (boolean :tag "Please ignore this button"))))
3867 (defcustom org-emphasis-alist
3868 `(("*" bold "<b>" "</b>")
3869 ("/" italic "<i>" "</i>")
3870 ("_" underline "<span style=\"text-decoration:underline;\">" "</span>")
3871 ("=" org-code "<code>" "</code>" verbatim)
3872 ("~" org-verbatim "<code>" "</code>" verbatim)
3873 ("+" ,(if (featurep 'xemacs) 'org-table '(:strike-through t))
3874 "<del>" "</del>")
3876 "Special syntax for emphasized text.
3877 Text starting and ending with a special character will be emphasized, for
3878 example *bold*, _underlined_ and /italic/. This variable sets the marker
3879 characters, the face to be used by font-lock for highlighting in Org-mode
3880 Emacs buffers, and the HTML tags to be used for this.
3881 For LaTeX export, see the variable `org-export-latex-emphasis-alist'.
3882 For DocBook export, see the variable `org-export-docbook-emphasis-alist'.
3883 Use customize to modify this, or restart Emacs after changing it."
3884 :group 'org-appearance
3885 :set 'org-set-emph-re
3886 :type '(repeat
3887 (list
3888 (string :tag "Marker character")
3889 (choice
3890 (face :tag "Font-lock-face")
3891 (plist :tag "Face property list"))
3892 (string :tag "HTML start tag")
3893 (string :tag "HTML end tag")
3894 (option (const verbatim)))))
3896 (defvar org-syntax-table
3897 (let ((st (make-syntax-table)))
3898 (mapc (lambda(c) (modify-syntax-entry
3899 (string-to-char (car c)) "w p" st))
3900 org-emphasis-alist)
3901 st))
3903 (defvar org-protecting-blocks
3904 '("src" "example" "latex" "ascii" "html" "docbook" "ditaa" "dot" "r" "R")
3905 "Blocks that contain text that is quoted, i.e. not processed as Org syntax.
3906 This is needed for font-lock setup.")
3908 ;;; Miscellaneous options
3910 (defgroup org-completion nil
3911 "Completion in Org-mode."
3912 :tag "Org Completion"
3913 :group 'org)
3915 (defcustom org-completion-use-ido nil
3916 "Non-nil means use ido completion wherever possible.
3917 Note that `ido-mode' must be active for this variable to be relevant.
3918 If you decide to turn this variable on, you might well want to turn off
3919 `org-outline-path-complete-in-steps'.
3920 See also `org-completion-use-iswitchb'."
3921 :group 'org-completion
3922 :type 'boolean)
3924 (defcustom org-completion-use-iswitchb nil
3925 "Non-nil means use iswitchb completion wherever possible.
3926 Note that `iswitchb-mode' must be active for this variable to be relevant.
3927 If you decide to turn this variable on, you might well want to turn off
3928 `org-outline-path-complete-in-steps'.
3929 Note that this variable has only an effect if `org-completion-use-ido' is nil."
3930 :group 'org-completion
3931 :type 'boolean)
3933 (defcustom org-completion-fallback-command 'hippie-expand
3934 "The expansion command called by \\[pcomplete] in normal context.
3935 Normal means, no org-mode-specific context."
3936 :group 'org-completion
3937 :type 'function)
3939 ;;; Functions and variables from their packages
3940 ;; Declared here to avoid compiler warnings
3942 ;; XEmacs only
3943 (defvar outline-mode-menu-heading)
3944 (defvar outline-mode-menu-show)
3945 (defvar outline-mode-menu-hide)
3946 (defvar zmacs-regions) ; XEmacs regions
3948 ;; Emacs only
3949 (defvar mark-active)
3951 ;; Various packages
3952 (declare-function calendar-absolute-from-iso "cal-iso" (date))
3953 (declare-function calendar-forward-day "cal-move" (arg))
3954 (declare-function calendar-goto-date "cal-move" (date))
3955 (declare-function calendar-goto-today "cal-move" ())
3956 (declare-function calendar-iso-from-absolute "cal-iso" (date))
3957 (defvar calc-embedded-close-formula)
3958 (defvar calc-embedded-open-formula)
3959 (declare-function cdlatex-tab "ext:cdlatex" ())
3960 (declare-function cdlatex-compute-tables "ext:cdlatex" ())
3961 (declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep))
3962 (defvar font-lock-unfontify-region-function)
3963 (declare-function iswitchb-read-buffer "iswitchb"
3964 (prompt &optional default require-match start matches-set))
3965 (defvar iswitchb-temp-buflist)
3966 (declare-function org-gnus-follow-link "org-gnus" (&optional group article))
3967 (defvar org-agenda-tags-todo-honor-ignore-options)
3968 (declare-function org-agenda-skip "org-agenda" ())
3969 (declare-function
3970 org-agenda-format-item "org-agenda"
3971 (extra txt &optional level category tags dotime noprefix remove-re habitp))
3972 (declare-function org-agenda-new-marker "org-agenda" (&optional pos))
3973 (declare-function org-agenda-change-all-lines "org-agenda"
3974 (newhead hdmarker &optional fixface just-this))
3975 (declare-function org-agenda-set-restriction-lock "org-agenda" (&optional type))
3976 (declare-function org-agenda-maybe-redo "org-agenda" ())
3977 (declare-function org-agenda-save-markers-for-cut-and-paste "org-agenda"
3978 (beg end))
3979 (declare-function org-agenda-copy-local-variable "org-agenda" (var))
3980 (declare-function org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item
3981 "org-agenda" (&optional end))
3982 (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
3983 (declare-function org-inlinetask-in-task-p "org-inlinetask" ())
3984 (declare-function org-inlinetask-goto-beginning "org-inlinetask" ())
3985 (declare-function org-inlinetask-goto-end "org-inlinetask" ())
3986 (declare-function org-indent-mode "org-indent" (&optional arg))
3987 (declare-function parse-time-string "parse-time" (string))
3988 (declare-function org-attach-reveal "org-attach" (&optional if-exists))
3989 (declare-function org-export-latex-fix-inputenc "org-latex" ())
3990 (declare-function orgtbl-send-table "org-table" (&optional maybe))
3991 (defvar remember-data-file)
3992 (defvar texmathp-why)
3993 (declare-function speedbar-line-directory "speedbar" (&optional depth))
3994 (declare-function table--at-cell-p "table" (position &optional object at-column))
3996 (defvar org-latex-regexps)
3998 ;;; Autoload and prepare some org modules
4000 ;; Some table stuff that needs to be defined here, because it is used
4001 ;; by the functions setting up org-mode or checking for table context.
4003 (defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)"
4004 "Detect an org-type or table-type table.")
4005 (defconst org-table-line-regexp "^[ \t]*|"
4006 "Detect an org-type table line.")
4007 (defconst org-table-dataline-regexp "^[ \t]*|[^-]"
4008 "Detect an org-type table line.")
4009 (defconst org-table-hline-regexp "^[ \t]*|-"
4010 "Detect an org-type table hline.")
4011 (defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]"
4012 "Detect a table-type table hline.")
4013 (defconst org-table-any-border-regexp "^[ \t]*[^|+ \t]"
4014 "Detect the first line outside a table when searching from within it.
4015 This works for both table types.")
4017 ;; Autoload the functions in org-table.el that are needed by functions here.
4019 (eval-and-compile
4020 (org-autoload "org-table"
4021 '(org-table-begin org-table-blank-field org-table-end)))
4023 ;;;###autoload
4024 (defun turn-on-orgtbl ()
4025 "Unconditionally turn on `orgtbl-mode'."
4026 (require 'org-table)
4027 (orgtbl-mode 1))
4029 (defun org-at-table-p (&optional table-type)
4030 "Return t if the cursor is inside an org-type table.
4031 If TABLE-TYPE is non-nil, also check for table.el-type tables."
4032 (if org-enable-table-editor
4033 (save-excursion
4034 (beginning-of-line 1)
4035 (looking-at (if table-type org-table-any-line-regexp
4036 org-table-line-regexp)))
4037 nil))
4038 (defsubst org-table-p () (org-at-table-p))
4040 (defun org-at-table.el-p ()
4041 "Return t if and only if we are at a table.el table."
4042 (and (org-at-table-p 'any)
4043 (save-excursion
4044 (goto-char (org-table-begin 'any))
4045 (looking-at org-table1-hline-regexp))))
4046 (defun org-table-recognize-table.el ()
4047 "If there is a table.el table nearby, recognize it and move into it."
4048 (if org-table-tab-recognizes-table.el
4049 (if (org-at-table.el-p)
4050 (progn
4051 (beginning-of-line 1)
4052 (if (looking-at org-table-dataline-regexp)
4054 (if (looking-at org-table1-hline-regexp)
4055 (progn
4056 (beginning-of-line 2)
4057 (if (looking-at org-table-any-border-regexp)
4058 (beginning-of-line -1)))))
4059 (if (re-search-forward "|" (org-table-end t) t)
4060 (progn
4061 (require 'table)
4062 (if (table--at-cell-p (point))
4064 (message "recognizing table.el table...")
4065 (table-recognize-table)
4066 (message "recognizing table.el table...done")))
4067 (error "This should not happen"))
4069 nil)
4070 nil))
4072 (defun org-at-table-hline-p ()
4073 "Return t if the cursor is inside a hline in a table."
4074 (if org-enable-table-editor
4075 (save-excursion
4076 (beginning-of-line 1)
4077 (looking-at org-table-hline-regexp))
4078 nil))
4080 (defvar org-table-clean-did-remove-column nil)
4082 (defun org-table-map-tables (function