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