ox-latex: Make org-latex-custom-lang-environments a defcustom
[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-2015 Free Software Foundation, Inc.
5 ;;
6 ;; Author: Carsten Dominik <carsten at orgmode dot org>
7 ;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
8 ;; Keywords: outlines, hypermedia, calendar, wp
9 ;; Homepage: http://orgmode.org
10 ;;
11 ;; This file is part of GNU Emacs.
12 ;;
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 <http://www.gnu.org/licenses/>.
25 ;;
26 ;;; Commentary:
27 ;;
28 ;; Org-mode is a mode for keeping notes, maintaining ToDo lists, and doing
29 ;; project planning with a fast and effective plain-text system.
30 ;;
31 ;; Org-mode develops organizational tasks around NOTES files that contain
32 ;; information about projects as plain text. Org-mode is implemented on
33 ;; top of outline-mode, which makes it possible to keep the content of
34 ;; large files well structured. Visibility cycling and structure editing
35 ;; help to work with the tree. Tables are easily created with a built-in
36 ;; table editor. Org-mode supports ToDo items, deadlines, time stamps,
37 ;; and scheduling. It dynamically compiles entries into an agenda that
38 ;; utilizes and smoothly integrates much of the Emacs calendar and diary.
39 ;; Plain text URL-like links connect to websites, emails, Usenet
40 ;; messages, BBDB entries, and any files related to the projects. For
41 ;; printing and sharing of notes, an Org-mode file can be exported as a
42 ;; structured ASCII file, as HTML, or (todo and agenda items only) as an
43 ;; iCalendar file. It can also serve as a publishing tool for a set of
44 ;; linked webpages.
45 ;;
46 ;; Installation and Activation
47 ;; ---------------------------
48 ;; See the corresponding sections in the manual at
49 ;;
50 ;; http://orgmode.org/org.html#Installation
51 ;;
52 ;; Documentation
53 ;; -------------
54 ;; The documentation of Org-mode can be found in the TeXInfo file. The
55 ;; distribution also contains a PDF version of it. At the homepage of
56 ;; Org-mode, you can read the same text online as HTML. There is also an
57 ;; excellent reference card made by Philip Rooke. This card can be found
58 ;; in the etc/ directory of Emacs 22.
59 ;;
60 ;; A list of recent changes can be found at
61 ;; http://orgmode.org/Changes.html
62 ;;
63 ;;; Code:
65 (defvar org-inhibit-highlight-removal nil) ; dynamically scoped param
66 (defvar-local org-table-formula-constants-local nil
67 "Local version of `org-table-formula-constants'.")
69 ;;;; Require other packages
71 (require 'cl-lib)
73 (eval-when-compile
74 (require 'cl)
75 (require 'gnus-sum))
77 (require 'calendar)
78 (require 'find-func)
79 (require 'format-spec)
81 (or (equal this-command 'eval-buffer)
82 (condition-case nil
83 (load (concat (file-name-directory load-file-name)
84 "org-loaddefs.el")
85 nil t t t)
86 (error
87 (message "WARNING: No org-loaddefs.el file could be found from where org.el is loaded.")
88 (sit-for 3)
89 (message "You need to run \"make\" or \"make autoloads\" from Org lisp directory")
90 (sit-for 3))))
92 (require 'org-macs)
93 (require 'org-compat)
95 ;; `org-outline-regexp' ought to be a defconst but is let-bound in
96 ;; some places -- e.g. see the macro `org-with-limited-levels'.
97 ;;
98 ;; In Org buffers, the value of `outline-regexp' is that of
99 ;; `org-outline-regexp'. The only function still directly relying on
100 ;; `outline-regexp' is `org-overview' so that `org-cycle' can do its
101 ;; job when `orgstruct-mode' is active.
102 (defvar org-outline-regexp "\\*+ "
103 "Regexp to match Org headlines.")
105 (defvar org-outline-regexp-bol "^\\*+ "
106 "Regexp to match Org headlines.
107 This is similar to `org-outline-regexp' but additionally makes
108 sure that we are at the beginning of the line.")
110 (defvar org-heading-regexp "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
111 "Matches a headline, putting stars and text into groups.
112 Stars are put in group 1 and the trimmed body in group 2.")
114 (declare-function cdlatex-environment "ext:cdlatex" (environment item))
115 (declare-function org-add-archive-files "org-archive" (files))
116 (declare-function org-agenda-entry-get-agenda-timestamp "org-agenda" (pom))
117 (declare-function org-agenda-list "org-agenda" (&optional arg start-day span))
118 (declare-function org-agenda-redo "org-agenda" (&optional all))
119 (declare-function org-babel-do-in-edit-buffer "ob-core" (&rest body))
120 (declare-function org-babel-tangle-file "ob-tangle" (file &optional target-file lang))
121 (declare-function org-beamer-mode "ox-beamer" ())
122 (declare-function org-clock-get-last-clock-out-time "org-clock" ())
123 (declare-function org-clock-out "org-clock" (&optional switch-to-state fail-quietly at-time))
124 (declare-function org-clock-remove-overlays "org-clock" (&optional beg end noremove))
125 (declare-function org-clock-sum "org-clock" (&optional tstart tend headline-filter propname))
126 (declare-function org-clock-sum-current-item "org-clock" (&optional tstart))
127 (declare-function org-clock-timestamps-down "org-clock" (&optional n))
128 (declare-function org-clock-timestamps-up "org-clock" (&optional n))
129 (declare-function org-clock-update-time-maybe "org-clock" ())
130 (declare-function org-clocktable-shift "org-clock" (dir n))
131 (declare-function org-element-at-point "org-element" ())
132 (declare-function org-element-cache-refresh "org-element" (pos))
133 (declare-function org-element-cache-reset "org-element" (&optional all))
134 (declare-function org-element-contents "org-element" (element))
135 (declare-function org-element-context "org-element" (&optional element))
136 (declare-function org-element-copy "org-element" (datum))
137 (declare-function org-element-interpret-data "org-element" (data &optional parent))
138 (declare-function org-element-lineage "org-element" (blob &optional types with-self))
139 (declare-function org-element-nested-p "org-element" (elem-a elem-b))
140 (declare-function org-element-parse-buffer "org-element" (&optional granularity visible-only))
141 (declare-function org-element-property "org-element" (property element))
142 (declare-function org-element-put-property "org-element" (element property value))
143 (declare-function org-element-swap-A-B "org-element" (elem-a elem-b))
144 (declare-function org-element-type "org-element" (element))
145 (declare-function org-element-update-syntax "org-element" ())
146 (declare-function org-id-find-id-file "org-id" (id))
147 (declare-function org-id-get-create "org-id" (&optional force))
148 (declare-function org-inlinetask-at-task-p "org-inlinetask" ())
149 (declare-function org-inlinetask-outline-regexp "org-inlinetask" ())
150 (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ())
151 (declare-function org-plot/gnuplot "org-plot" (&optional params))
152 (declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label))
153 (declare-function org-table-align "org-table" ())
154 (declare-function org-table-begin "org-table" (&optional table-type))
155 (declare-function org-table-beginning-of-field "org-table" (&optional n))
156 (declare-function org-table-blank-field "org-table" ())
157 (declare-function org-table-calc-current-TBLFM "org-table" (&optional arg))
158 (declare-function org-table-edit-field "org-table" (arg))
159 (declare-function org-table-end "org-table" (&optional table-type))
160 (declare-function org-table-end-of-field "org-table" (&optional n))
161 (declare-function org-table-insert-row "org-table" (&optional arg))
162 (declare-function org-table-justify-field-maybe "org-table" (&optional new))
163 (declare-function org-table-maybe-eval-formula "org-table" ())
164 (declare-function org-table-maybe-recalculate-line "org-table" ())
165 (declare-function org-table-next-row "org-table" ())
166 (declare-function org-table-paste-rectangle "org-table" ())
167 (declare-function org-table-wrap-region "org-table" (arg))
168 (declare-function org-tags-view "org-agenda" (&optional todo-only match))
169 (declare-function orgtbl-ascii-plot "org-table" (&optional ask))
170 (declare-function orgtbl-mode "org-table" (&optional arg))
172 (defsubst org-uniquify (list)
173 "Non-destructively remove duplicate elements from LIST."
174 (let ((res (copy-sequence list))) (delete-dups res)))
176 (defsubst org-get-at-bol (property)
177 "Get text property PROPERTY at the beginning of line."
178 (get-text-property (point-at-bol) property))
180 (defsubst org-trim (s)
181 "Remove whitespace at the beginning and the end of string S."
182 (replace-regexp-in-string
183 "\\`[ \t\n\r]+" ""
184 (replace-regexp-in-string "[ \t\n\r]+\\'" "" s)))
186 ;; load languages based on value of `org-babel-load-languages'
187 (defvar org-babel-load-languages)
189 ;;;###autoload
190 (defun org-babel-do-load-languages (sym value)
191 "Load the languages defined in `org-babel-load-languages'."
192 (set-default sym value)
193 (mapc (lambda (pair)
194 (let ((active (cdr pair)) (lang (symbol-name (car pair))))
195 (if active
196 (progn
197 (require (intern (concat "ob-" lang))))
198 (progn
199 (funcall 'fmakunbound
200 (intern (concat "org-babel-execute:" lang)))
201 (funcall 'fmakunbound
202 (intern (concat "org-babel-expand-body:" lang)))))))
203 org-babel-load-languages))
205 (declare-function org-babel-tangle-file "ob-tangle" (file &optional target-file lang))
206 ;;;###autoload
207 (defun org-babel-load-file (file &optional compile)
208 "Load Emacs Lisp source code blocks in the Org-mode FILE.
209 This function exports the source code using `org-babel-tangle'
210 and then loads the resulting file using `load-file'. With prefix
211 arg (noninteractively: 2nd arg) COMPILE the tangled Emacs Lisp
212 file to byte-code before it is loaded."
213 (interactive "fFile to load: \nP")
214 (let* ((age (lambda (file)
215 (float-time
216 (time-subtract (current-time)
217 (nth 5 (or (file-attributes (file-truename file))
218 (file-attributes file)))))))
219 (base-name (file-name-sans-extension file))
220 (exported-file (concat base-name ".el")))
221 ;; tangle if the org-mode file is newer than the elisp file
222 (unless (and (file-exists-p exported-file)
223 (> (funcall age file) (funcall age exported-file)))
224 ;; Tangle-file traversal returns reversed list of tangled files
225 ;; and we want to evaluate the first target.
226 (setq exported-file
227 (car (last (org-babel-tangle-file file exported-file "emacs-lisp")))))
228 (message "%s %s"
229 (if compile
230 (progn (byte-compile-file exported-file 'load)
231 "Compiled and loaded")
232 (progn (load-file exported-file) "Loaded"))
233 exported-file)))
235 (defcustom org-babel-load-languages '((emacs-lisp . t))
236 "Languages which can be evaluated in Org-mode buffers.
237 This list can be used to load support for any of the languages
238 below, note that each language will depend on a different set of
239 system executables and/or Emacs modes. When a language is
240 \"loaded\", then code blocks in that language can be evaluated
241 with `org-babel-execute-src-block' bound by default to C-c
242 C-c (note the `org-babel-no-eval-on-ctrl-c-ctrl-c' variable can
243 be set to remove code block evaluation from the C-c C-c
244 keybinding. By default only Emacs Lisp (which has no
245 requirements) is loaded."
246 :group 'org-babel
247 :set 'org-babel-do-load-languages
248 :version "24.1"
249 :type '(alist :tag "Babel Languages"
250 :key-type
251 (choice
252 (const :tag "Awk" awk)
253 (const :tag "C" C)
254 (const :tag "R" R)
255 (const :tag "Asymptote" asymptote)
256 (const :tag "Calc" calc)
257 (const :tag "Clojure" clojure)
258 (const :tag "CSS" css)
259 (const :tag "Ditaa" ditaa)
260 (const :tag "Dot" dot)
261 (const :tag "Emacs Lisp" emacs-lisp)
262 (const :tag "Forth" forth)
263 (const :tag "Fortran" fortran)
264 (const :tag "Gnuplot" gnuplot)
265 (const :tag "Haskell" haskell)
266 (const :tag "IO" io)
267 (const :tag "J" J)
268 (const :tag "Java" java)
269 (const :tag "Javascript" js)
270 (const :tag "LaTeX" latex)
271 (const :tag "Ledger" ledger)
272 (const :tag "Lilypond" lilypond)
273 (const :tag "Lisp" lisp)
274 (const :tag "Makefile" makefile)
275 (const :tag "Maxima" maxima)
276 (const :tag "Matlab" matlab)
277 (const :tag "Mscgen" mscgen)
278 (const :tag "Ocaml" ocaml)
279 (const :tag "Octave" octave)
280 (const :tag "Org" org)
281 (const :tag "Perl" perl)
282 (const :tag "Pico Lisp" picolisp)
283 (const :tag "PlantUML" plantuml)
284 (const :tag "Python" python)
285 (const :tag "Ruby" ruby)
286 (const :tag "Sass" sass)
287 (const :tag "Scala" scala)
288 (const :tag "Scheme" scheme)
289 (const :tag "Screen" screen)
290 (const :tag "Shell Script" shell)
291 (const :tag "Shen" shen)
292 (const :tag "Sql" sql)
293 (const :tag "Sqlite" sqlite)
294 (const :tag "Stan" stan)
295 (const :tag "ebnf2ps" ebnf2ps))
296 :value-type (boolean :tag "Activate" :value t)))
298 ;;;; Customization variables
299 (defcustom org-clone-delete-id nil
300 "Remove ID property of clones of a subtree.
301 When non-nil, clones of a subtree don't inherit the ID property.
302 Otherwise they inherit the ID property with a new unique
303 identifier."
304 :type 'boolean
305 :version "24.1"
306 :group 'org-id)
308 ;;; Version
309 (org-check-version)
311 ;;;###autoload
312 (defun org-version (&optional here full message)
313 "Show the org-mode version.
314 Interactively, or when MESSAGE is non-nil, show it in echo area.
315 With prefix argument, or when HERE is non-nil, insert it at point.
316 In non-interactive uses, a reduced version string is output unless
317 FULL is given."
318 (interactive (list current-prefix-arg t (not current-prefix-arg)))
319 (let* ((org-dir (ignore-errors (org-find-library-dir "org")))
320 (save-load-suffixes (when (boundp 'load-suffixes) load-suffixes))
321 (load-suffixes (list ".el"))
322 (org-install-dir (ignore-errors (org-find-library-dir "org-loaddefs")))
323 (org-trash (or
324 (and (fboundp 'org-release) (fboundp 'org-git-version))
325 (org-load-noerror-mustsuffix (concat org-dir "org-version"))))
326 (load-suffixes save-load-suffixes)
327 (org-version (org-release))
328 (git-version (org-git-version))
329 (version (format "Org-mode version %s (%s @ %s)"
330 org-version
331 git-version
332 (if org-install-dir
333 (if (string= org-dir org-install-dir)
334 org-install-dir
335 (concat "mixed installation! " org-install-dir " and " org-dir))
336 "org-loaddefs.el can not be found!")))
337 (version1 (if full version org-version)))
338 (when here (insert version1))
339 (when message (message "%s" version1))
340 version1))
342 (defconst org-version (org-version))
344 \f
345 ;;; Syntax Constants
347 ;;;; Block
349 (defconst org-block-regexp
350 "^[ \t]*#\\+begin_?\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_?\\1[ \t]*$"
351 "Regular expression for hiding blocks.")
353 (defconst org-dblock-start-re
354 "^[ \t]*#\\+\\(?:BEGIN\\|begin\\):[ \t]+\\(\\S-+\\)\\([ \t]+\\(.*\\)\\)?"
355 "Matches the start line of a dynamic block, with parameters.")
357 (defconst org-dblock-end-re "^[ \t]*#\\+\\(?:END\\|end\\)\\([: \t\r\n]\\|$\\)"
358 "Matches the end of a dynamic block.")
360 ;;;; Clock and Planning
362 (defconst org-clock-string "CLOCK:"
363 "String used as prefix for timestamps clocking work hours on an item.")
365 (defvar org-closed-string "CLOSED:"
366 "String used as the prefix for timestamps logging closing a TODO entry.")
368 (defvar org-deadline-string "DEADLINE:"
369 "String to mark deadline entries.
370 A deadline is this string, followed by a time stamp. Should be a word,
371 terminated by a colon. You can insert a schedule keyword and
372 a timestamp with \\[org-deadline].")
374 (defvar org-scheduled-string "SCHEDULED:"
375 "String to mark scheduled TODO entries.
376 A schedule is this string, followed by a time stamp. Should be a word,
377 terminated by a colon. You can insert a schedule keyword and
378 a timestamp with \\[org-schedule].")
380 (defconst org-ds-keyword-length
381 (+ 2
382 (apply #'max
383 (mapcar #'length
384 (list org-deadline-string org-scheduled-string
385 org-clock-string org-closed-string))))
386 "Maximum length of the DEADLINE and SCHEDULED keywords.")
388 (defconst org-planning-line-re
389 (concat "^[ \t]*"
390 (regexp-opt
391 (list org-closed-string org-deadline-string org-scheduled-string)
392 t))
393 "Matches a line with planning info.
394 Matched keyword is in group 1.")
396 (defconst org-clock-line-re
397 (concat "^[ \t]*" org-clock-string)
398 "Matches a line with clock info.")
400 (defconst org-deadline-regexp (concat "\\<" org-deadline-string)
401 "Matches the DEADLINE keyword.")
403 (defconst org-deadline-time-regexp
404 (concat "\\<" org-deadline-string " *<\\([^>]+\\)>")
405 "Matches the DEADLINE keyword together with a time stamp.")
407 (defconst org-deadline-time-hour-regexp
408 (concat "\\<" org-deadline-string
409 " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9-+:hdwmy \t.]*\\)>")
410 "Matches the DEADLINE keyword together with a time-and-hour stamp.")
412 (defconst org-deadline-line-regexp
413 (concat "\\<\\(" org-deadline-string "\\).*")
414 "Matches the DEADLINE keyword and the rest of the line.")
416 (defconst org-scheduled-regexp (concat "\\<" org-scheduled-string)
417 "Matches the SCHEDULED keyword.")
419 (defconst org-scheduled-time-regexp
420 (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>")
421 "Matches the SCHEDULED keyword together with a time stamp.")
423 (defconst org-scheduled-time-hour-regexp
424 (concat "\\<" org-scheduled-string
425 " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9-+:hdwmy \t.]*\\)>")
426 "Matches the SCHEDULED keyword together with a time-and-hour stamp.")
428 (defconst org-closed-time-regexp
429 (concat "\\<" org-closed-string " *\\[\\([^]]+\\)\\]")
430 "Matches the CLOSED keyword together with a time stamp.")
432 (defconst org-keyword-time-regexp
433 (concat "\\<"
434 (regexp-opt
435 (list org-scheduled-string org-deadline-string org-closed-string
436 org-clock-string)
437 t)
438 " *[[<]\\([^]>]+\\)[]>]")
439 "Matches any of the 4 keywords, together with the time stamp.")
441 (defconst org-keyword-time-not-clock-regexp
442 (concat
443 "\\<"
444 (regexp-opt
445 (list org-scheduled-string org-deadline-string org-closed-string) t)
446 " *[[<]\\([^]>]+\\)[]>]")
447 "Matches any of the 3 keywords, together with the time stamp.")
449 (defconst org-maybe-keyword-time-regexp
450 (concat "\\(\\<"
451 (regexp-opt
452 (list org-scheduled-string org-deadline-string org-closed-string
453 org-clock-string)
454 t)
455 "\\)?"
456 " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^]\r\n>]*?[]>]"
457 "\\|"
458 "<%%([^\r\n>]*>\\)")
459 "Matches a timestamp, possibly preceded by a keyword.")
461 (defconst org-all-time-keywords
462 (mapcar (lambda (w) (substring w 0 -1))
463 (list org-scheduled-string org-deadline-string
464 org-clock-string org-closed-string))
465 "List of time keywords.")
467 ;;;; Drawer
469 (defconst org-drawer-regexp "^[ \t]*:\\(\\(?:\\w\\|[-_]\\)+\\):[ \t]*$"
470 "Matches first or last line of a hidden block.
471 Group 1 contains drawer's name or \"END\".")
473 (defconst org-property-start-re "^[ \t]*:PROPERTIES:[ \t]*$"
474 "Regular expression matching the first line of a property drawer.")
476 (defconst org-property-end-re "^[ \t]*:END:[ \t]*$"
477 "Regular expression matching the last line of a property drawer.")
479 (defconst org-clock-drawer-start-re "^[ \t]*:CLOCK:[ \t]*$"
480 "Regular expression matching the first line of a clock drawer.")
482 (defconst org-clock-drawer-end-re "^[ \t]*:END:[ \t]*$"
483 "Regular expression matching the last line of a clock drawer.")
485 (defconst org-property-drawer-re
486 (concat "^[ \t]*:PROPERTIES:[ \t]*\n"
487 "\\(?:[ \t]*:\\S-+:\\(?: .*\\)?[ \t]*\n\\)*?"
488 "[ \t]*:END:[ \t]*$")
489 "Matches an entire property drawer.")
491 (defconst org-clock-drawer-re
492 (concat "\\(" org-clock-drawer-start-re "\\)[^\000]*?\\("
493 org-clock-drawer-end-re "\\)\n?")
494 "Matches an entire clock drawer.")
496 ;;;; Headline
498 (defconst org-heading-keyword-regexp-format
499 "^\\(\\*+\\)\\(?: +%s\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
500 "Printf format for a regexp matching a headline with some keyword.
501 This regexp will match the headline of any node which has the
502 exact keyword that is put into the format. The keyword isn't in
503 any group by default, but the stars and the body are.")
505 (defconst org-heading-keyword-maybe-regexp-format
506 "^\\(\\*+\\)\\(?: +%s\\)?\\(?: +\\(.*?\\)\\)?[ \t]*$"
507 "Printf format for a regexp matching a headline, possibly with some keyword.
508 This regexp can match any headline with the specified keyword, or
509 without a keyword. The keyword isn't in any group by default,
510 but the stars and the body are.")
512 (defconst org-archive-tag "ARCHIVE"
513 "The tag that marks a subtree as archived.
514 An archived subtree does not open during visibility cycling, and does
515 not contribute to the agenda listings.")
517 (defconst org-comment-string "COMMENT"
518 "Entries starting with this keyword will never be exported.
519 An entry can be toggled between COMMENT and normal with
520 \\[org-toggle-comment].")
523 ;;;; LaTeX Environments and Fragments
525 (defconst org-latex-regexps
526 '(("begin" "^[ \t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t)
527 ;; ("$" "\\([ (]\\|^\\)\\(\\(\\([$]\\)\\([^ \r\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \r\n,.$]\\)\\4\\)\\)\\([ .,?;:'\")]\\|$\\)" 2 nil)
528 ;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p
529 ("$1" "\\([^$]\\|^\\)\\(\\$[^ \r\n,;.$]\\$\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|$\\)" 2 nil)
530 ("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|$\\)" 2 nil)
531 ("\\(" "\\\\([^\000]*?\\\\)" 0 nil)
532 ("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 nil)
533 ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil))
534 "Regular expressions for matching embedded LaTeX.")
536 ;;;; Node Property
538 (defconst org-effort-property "Effort"
539 "The property that is being used to keep track of effort estimates.
540 Effort estimates given in this property need to have the format H:MM.")
542 ;;;; Table
544 (defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)"
545 "Detect an org-type or table-type table.")
547 (defconst org-table-line-regexp "^[ \t]*|"
548 "Detect an org-type table line.")
550 (defconst org-table-dataline-regexp "^[ \t]*|[^-]"
551 "Detect an org-type table line.")
553 (defconst org-table-hline-regexp "^[ \t]*|-"
554 "Detect an org-type table hline.")
556 (defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]"
557 "Detect a table-type table hline.")
559 (defconst org-table-any-border-regexp "^[ \t]*[^|+ \t]"
560 "Detect the first line outside a table when searching from within it.
561 This works for both table types.")
563 (defconst org-TBLFM-regexp "^[ \t]*#\\+TBLFM: "
564 "Detect a #+TBLFM line.")
566 ;;;; Timestamp
568 (defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^\r\n>]*?\\)>"
569 "Regular expression for fast time stamp matching.")
571 (defconst org-ts-regexp-inactive
572 "\\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^\r\n>]*?\\)\\]"
573 "Regular expression for fast inactive time stamp matching.")
575 (defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^]\r\n>]*?\\)[]>]"
576 "Regular expression for fast time stamp matching.")
578 (defconst org-ts-regexp0
579 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\( +[^]+0-9>\r\n -]+\\)?\\( +\\([0-9]\\{1,2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
580 "Regular expression matching time strings for analysis.
581 This one does not require the space after the date, so it can be used
582 on a string that terminates immediately after the date.")
584 (defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) *\\([^]+0-9>\r\n -]*\\)\\( \\([0-9]\\{1,2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
585 "Regular expression matching time strings for analysis.")
587 (defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,16\\}>")
588 "Regular expression matching time stamps, with groups.")
590 (defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[^]>\n]\\{0,16\\}[]>]")
591 "Regular expression matching time stamps (also [..]), with groups.")
593 (defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp)
594 "Regular expression matching a time stamp range.")
596 (defconst org-tr-regexp-both
597 (concat org-ts-regexp-both "--?-?" org-ts-regexp-both)
598 "Regular expression matching a time stamp range.")
600 (defconst org-tsr-regexp (concat org-ts-regexp "\\(--?-?"
601 org-ts-regexp "\\)?")
602 "Regular expression matching a time stamp or time stamp range.")
604 (defconst org-tsr-regexp-both
605 (concat org-ts-regexp-both "\\(--?-?"
606 org-ts-regexp-both "\\)?")
607 "Regular expression matching a time stamp or time stamp range.
608 The time stamps may be either active or inactive.")
610 (defconst org-repeat-re
611 "<[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^>\n]*?\\([.+]?\\+[0-9]+[hdwmy]\\(/[0-9]+[hdwmy]\\)?\\)"
612 "Regular expression for specifying repeated events.
613 After a match, group 1 contains the repeat expression.")
615 (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
616 "Formats for `format-time-string' which are used for time stamps.")
618 \f
619 ;;; The custom variables
621 (defgroup org nil
622 "Outline-based notes management and organizer."
623 :tag "Org"
624 :group 'outlines
625 :group 'calendar)
627 (defcustom org-mode-hook nil
628 "Mode hook for Org-mode, run after the mode was turned on."
629 :group 'org
630 :type 'hook)
632 (defcustom org-load-hook nil
633 "Hook that is run after org.el has been loaded."
634 :group 'org
635 :type 'hook)
637 (defcustom org-log-buffer-setup-hook nil
638 "Hook that is run after an Org log buffer is created."
639 :group 'org
640 :version "24.1"
641 :type 'hook)
643 (defvar org-modules) ; defined below
644 (defvar org-modules-loaded nil
645 "Have the modules been loaded already?")
647 (defun org-load-modules-maybe (&optional force)
648 "Load all extensions listed in `org-modules'."
649 (when (or force (not org-modules-loaded))
650 (mapc (lambda (ext)
651 (condition-case nil (require ext)
652 (error (message "Problems while trying to load feature `%s'" ext))))
653 org-modules)
654 (setq org-modules-loaded t)))
656 (defun org-set-modules (var value)
657 "Set VAR to VALUE and call `org-load-modules-maybe' with the force flag."
658 (set var value)
659 (when (featurep 'org)
660 (org-load-modules-maybe 'force)
661 (org-element-cache-reset 'all)))
663 (defcustom org-modules '(org-w3m org-bbdb org-bibtex org-docview org-gnus org-info org-irc org-mhe org-rmail)
664 "Modules that should always be loaded together with org.el.
666 If a description starts with <C>, the file is not part of Emacs
667 and loading it will require that you have downloaded and properly
668 installed the Org mode distribution.
670 You can also use this system to load external packages (i.e. neither Org
671 core modules, nor modules from the CONTRIB directory). Just add symbols
672 to the end of the list. If the package is called org-xyz.el, then you need
673 to add the symbol `xyz', and the package must have a call to:
675 (provide \\='org-xyz)
677 For export specific modules, see also `org-export-backends'."
678 :group 'org
679 :set 'org-set-modules
680 :version "24.4"
681 :package-version '(Org . "8.0")
682 :type
683 '(set :greedy t
684 (const :tag " bbdb: Links to BBDB entries" org-bbdb)
685 (const :tag " bibtex: Links to BibTeX entries" org-bibtex)
686 (const :tag " crypt: Encryption of subtrees" org-crypt)
687 (const :tag " ctags: Access to Emacs tags with links" org-ctags)
688 (const :tag " docview: Links to doc-view buffers" org-docview)
689 (const :tag " gnus: Links to GNUS folders/messages" org-gnus)
690 (const :tag " habit: Track your consistency with habits" org-habit)
691 (const :tag " id: Global IDs for identifying entries" org-id)
692 (const :tag " info: Links to Info nodes" org-info)
693 (const :tag " inlinetask: Tasks independent of outline hierarchy" org-inlinetask)
694 (const :tag " irc: Links to IRC/ERC chat sessions" org-irc)
695 (const :tag " mhe: Links to MHE folders/messages" org-mhe)
696 (const :tag " mouse: Additional mouse support" org-mouse)
697 (const :tag " protocol: Intercept calls from emacsclient" org-protocol)
698 (const :tag " rmail: Links to RMAIL folders/messages" org-rmail)
699 (const :tag " w3m: Special cut/paste from w3m to Org-mode." org-w3m)
701 (const :tag "C annotate-file: Annotate a file with org syntax" org-annotate-file)
702 (const :tag "C bookmark: Org-mode links to bookmarks" org-bookmark)
703 (const :tag "C bullets: Add overlays to headlines stars" org-bullets)
704 (const :tag "C checklist: Extra functions for checklists in repeated tasks" org-checklist)
705 (const :tag "C choose: Use TODO keywords to mark decisions states" org-choose)
706 (const :tag "C collector: Collect properties into tables" org-collector)
707 (const :tag "C depend: TODO dependencies for Org-mode\n\t\t\t(PARTIALLY OBSOLETE, see built-in dependency support))" org-depend)
708 (const :tag "C drill: Flashcards and spaced repetition for Org-mode" org-drill)
709 (const :tag "C elisp-symbol: Org-mode links to emacs-lisp symbols" org-elisp-symbol)
710 (const :tag "C eshell Support for links to working directories in eshell" org-eshell)
711 (const :tag "C eval-light: Evaluate inbuffer-code on demand" org-eval-light)
712 (const :tag "C eval: Include command output as text" org-eval)
713 (const :tag "C eww: Store link to url of eww" org-eww)
714 (const :tag "C expiry: Expiry mechanism for Org-mode entries" org-expiry)
715 (const :tag "C favtable: Lookup table of favorite references and links" org-favtable)
716 (const :tag "C git-link: Provide org links to specific file version" org-git-link)
717 (const :tag "C interactive-query: Interactive modification of tags query\n\t\t\t(PARTIALLY OBSOLETE, see secondary filtering)" org-interactive-query)
718 (const :tag "C invoice: Help manage client invoices in Org-mode" org-invoice)
719 (const :tag "C learn: SuperMemo's incremental learning algorithm" org-learn)
720 (const :tag "C mac-iCal Imports events from iCal.app to the Emacs diary" org-mac-iCal)
721 (const :tag "C mac-link: Grab links and url from various mac Applications" org-mac-link)
722 (const :tag "C mairix: Hook mairix search into Org-mode for different MUAs" org-mairix)
723 (const :tag "C man: Support for links to manpages in Org-mode" org-man)
724 (const :tag "C mew: Links to Mew folders/messages" org-mew)
725 (const :tag "C mtags: Support for muse-like tags" org-mtags)
726 (const :tag "C notmuch: Provide org links to notmuch searches or messages" org-notmuch)
727 (const :tag "C panel: Simple routines for us with bad memory" org-panel)
728 (const :tag "C registry: A registry for Org-mode links" org-registry)
729 (const :tag "C screen: Visit screen sessions through Org-mode links" org-screen)
730 (const :tag "C secretary: Team management with org-mode" org-secretary)
731 (const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert)
732 (const :tag "C toc: Table of contents for Org-mode buffer" org-toc)
733 (const :tag "C track: Keep up with Org-mode development" org-track)
734 (const :tag "C velocity Something like Notational Velocity for Org" org-velocity)
735 (const :tag "C vm: Links to VM folders/messages" org-vm)
736 (const :tag "C wikinodes: CamelCase wiki-like links" org-wikinodes)
737 (const :tag "C wl: Links to Wanderlust folders/messages" org-wl)
738 (repeat :tag "External packages" :inline t (symbol :tag "Package"))))
740 (defvar org-export-registered-backends) ; From ox.el.
741 (declare-function org-export-derived-backend-p "ox" (backend &rest backends))
742 (declare-function org-export-backend-name "ox" (backend))
743 (defcustom org-export-backends '(ascii html icalendar latex)
744 "List of export back-ends that should be always available.
746 If a description starts with <C>, the file is not part of Emacs
747 and loading it will require that you have downloaded and properly
748 installed the Org mode distribution.
750 Unlike to `org-modules', libraries in this list will not be
751 loaded along with Org, but only once the export framework is
752 needed.
754 This variable needs to be set before org.el is loaded. If you
755 need to make a change while Emacs is running, use the customize
756 interface or run the following code, where VAL stands for the new
757 value of the variable, after updating it:
759 (progn
760 (setq org-export-registered-backends
761 (cl-remove-if-not
762 (lambda (backend)
763 (let ((name (org-export-backend-name backend)))
764 (or (memq name val)
765 (catch \\='parentp
766 (dolist (b val)
767 (and (org-export-derived-backend-p b name)
768 (throw \\='parentp t)))))))
769 org-export-registered-backends))
770 (let ((new-list (mapcar #\\='org-export-backend-name
771 org-export-registered-backends)))
772 (dolist (backend val)
773 (cond
774 ((not (load (format \"ox-%s\" backend) t t))
775 (message \"Problems while trying to load export back-end \\=`%s\\='\"
776 backend))
777 ((not (memq backend new-list)) (push backend new-list))))
778 (set-default \\='org-export-backends new-list)))
780 Adding a back-end to this list will also pull the back-end it
781 depends on, if any."
782 :group 'org
783 :group 'org-export
784 :version "24.4"
785 :package-version '(Org . "8.0")
786 :initialize 'custom-initialize-set
787 :set (lambda (var val)
788 (if (not (featurep 'ox)) (set-default var val)
789 ;; Any back-end not required anymore (not present in VAL and not
790 ;; a parent of any back-end in the new value) is removed from the
791 ;; list of registered back-ends.
792 (setq org-export-registered-backends
793 (cl-remove-if-not
794 (lambda (backend)
795 (let ((name (org-export-backend-name backend)))
796 (or (memq name val)
797 (catch 'parentp
798 (dolist (b val)
799 (and (org-export-derived-backend-p b name)
800 (throw 'parentp t)))))))
801 org-export-registered-backends))
802 ;; Now build NEW-LIST of both new back-ends and required
803 ;; parents.
804 (let ((new-list (mapcar #'org-export-backend-name
805 org-export-registered-backends)))
806 (dolist (backend val)
807 (cond
808 ((not (load (format "ox-%s" backend) t t))
809 (message "Problems while trying to load export back-end `%s'"
810 backend))
811 ((not (memq backend new-list)) (push backend new-list))))
812 ;; Set VAR to that list with fixed dependencies.
813 (set-default var new-list))))
814 :type '(set :greedy t
815 (const :tag " ascii Export buffer to ASCII format" ascii)
816 (const :tag " beamer Export buffer to Beamer presentation" beamer)
817 (const :tag " html Export buffer to HTML format" html)
818 (const :tag " icalendar Export buffer to iCalendar format" icalendar)
819 (const :tag " latex Export buffer to LaTeX format" latex)
820 (const :tag " man Export buffer to MAN format" man)
821 (const :tag " md Export buffer to Markdown format" md)
822 (const :tag " odt Export buffer to ODT format" odt)
823 (const :tag " org Export buffer to Org format" org)
824 (const :tag " texinfo Export buffer to Texinfo format" texinfo)
825 (const :tag "C confluence Export buffer to Confluence Wiki format" confluence)
826 (const :tag "C deck Export buffer to deck.js presentations" deck)
827 (const :tag "C freemind Export buffer to Freemind mindmap format" freemind)
828 (const :tag "C groff Export buffer to Groff format" groff)
829 (const :tag "C koma-letter Export buffer to KOMA Scrlttrl2 format" koma-letter)
830 (const :tag "C RSS 2.0 Export buffer to RSS 2.0 format" rss)
831 (const :tag "C s5 Export buffer to s5 presentations" s5)
832 (const :tag "C taskjuggler Export buffer to TaskJuggler format" taskjuggler)))
834 (eval-after-load 'ox
835 '(mapc
836 (lambda (backend)
837 (condition-case nil (require (intern (format "ox-%s" backend)))
838 (error (message "Problems while trying to load export back-end `%s'"
839 backend))))
840 org-export-backends))
842 (defcustom org-support-shift-select nil
843 "Non-nil means make shift-cursor commands select text when possible.
844 \\<org-mode-map>\
846 In Emacs 23, when `shift-select-mode' is on, shifted cursor keys
847 start selecting a region, or enlarge regions started in this way.
848 In Org-mode, in special contexts, these same keys are used for
849 other purposes, important enough to compete with shift selection.
850 Org tries to balance these needs by supporting `shift-select-mode'
851 outside these special contexts, under control of this variable.
853 The default of this variable is nil, to avoid confusing behavior. Shifted
854 cursor keys will then execute Org commands in the following contexts:
855 - on a headline, changing TODO state (left/right) and priority (up/down)
856 - on a time stamp, changing the time
857 - in a plain list item, changing the bullet type
858 - in a property definition line, switching between allowed values
859 - in the BEGIN line of a clock table (changing the time block).
860 Outside these contexts, the commands will throw an error.
862 When this variable is t and the cursor is not in a special
863 context, Org-mode will support shift-selection for making and
864 enlarging regions. To make this more effective, the bullet
865 cycling will no longer happen anywhere in an item line, but only
866 if the cursor is exactly on the bullet.
868 If you set this variable to the symbol `always', then the keys
869 will not be special in headlines, property lines, and item lines,
870 to make shift selection work there as well. If this is what you
871 want, you can use the following alternative commands:
872 `\\[org-todo]' and `\\[org-priority]' \
873 to change TODO state and priority,
874 `\\[universal-argument] \\[universal-argument] \\[org-todo]' \
875 can be used to switch TODO sets,
876 `\\[org-ctrl-c-minus]' to cycle item bullet types,
877 and properties can be edited by hand or in column view.
879 However, when the cursor is on a timestamp, shift-cursor commands
880 will still edit the time stamp - this is just too good to give up.
882 XEmacs user should have this variable set to nil, because
883 `shift-select-mode' is in Emacs 23 or later only."
884 :group 'org
885 :type '(choice
886 (const :tag "Never" nil)
887 (const :tag "When outside special context" t)
888 (const :tag "Everywhere except timestamps" always)))
890 (defcustom org-loop-over-headlines-in-active-region nil
891 "Shall some commands act upon headlines in the active region?
893 When set to t, some commands will be performed in all headlines
894 within the active region.
896 When set to `start-level', some commands will be performed in all
897 headlines within the active region, provided that these headlines
898 are of the same level than the first one.
900 When set to a string, those commands will be performed on the
901 matching headlines within the active region. Such string must be
902 a tags/property/todo match as it is used in the agenda tags view.
904 The list of commands is: `org-schedule', `org-deadline',
905 `org-todo', `org-archive-subtree', `org-archive-set-tag' and
906 `org-archive-to-archive-sibling'. The archiving commands skip
907 already archived entries."
908 :type '(choice (const :tag "Don't loop" nil)
909 (const :tag "All headlines in active region" t)
910 (const :tag "In active region, headlines at the same level than the first one" start-level)
911 (string :tag "Tags/Property/Todo matcher"))
912 :version "24.1"
913 :group 'org-todo
914 :group 'org-archive)
916 (defgroup org-startup nil
917 "Options concerning startup of Org-mode."
918 :tag "Org Startup"
919 :group 'org)
921 (defcustom org-startup-folded t
922 "Non-nil means entering Org-mode will switch to OVERVIEW.
923 This can also be configured on a per-file basis by adding one of
924 the following lines anywhere in the buffer:
926 #+STARTUP: fold (or `overview', this is equivalent)
927 #+STARTUP: nofold (or `showall', this is equivalent)
928 #+STARTUP: content
929 #+STARTUP: showeverything
931 By default, this option is ignored when Org opens agenda files
932 for the first time. If you want the agenda to honor the startup
933 option, set `org-agenda-inhibit-startup' to nil."
934 :group 'org-startup
935 :type '(choice
936 (const :tag "nofold: show all" nil)
937 (const :tag "fold: overview" t)
938 (const :tag "content: all headlines" content)
939 (const :tag "show everything, even drawers" showeverything)))
941 (defcustom org-startup-truncated t
942 "Non-nil means entering Org-mode will set `truncate-lines'.
943 This is useful since some lines containing links can be very long and
944 uninteresting. Also tables look terrible when wrapped."
945 :group 'org-startup
946 :type 'boolean)
948 (defcustom org-startup-indented nil
949 "Non-nil means turn on `org-indent-mode' on startup.
950 This can also be configured on a per-file basis by adding one of
951 the following lines anywhere in the buffer:
953 #+STARTUP: indent
954 #+STARTUP: noindent"
955 :group 'org-structure
956 :type '(choice
957 (const :tag "Not" nil)
958 (const :tag "Globally (slow on startup in large files)" t)))
960 (defcustom org-use-sub-superscripts t
961 "Non-nil means interpret \"_\" and \"^\" for display.
963 If you want to control how Org exports those characters, see
964 `org-export-with-sub-superscripts'. `org-use-sub-superscripts'
965 used to be an alias for `org-export-with-sub-superscripts' in
966 Org <8.0, it is not anymore.
968 When this option is turned on, you can use TeX-like syntax for
969 sub- and superscripts within the buffer. Several characters after
970 \"_\" or \"^\" will be considered as a single item - so grouping
971 with {} is normally not needed. For example, the following things
972 will be parsed as single sub- or superscripts:
974 10^24 or 10^tau several digits will be considered 1 item.
975 10^-12 or 10^-tau a leading sign with digits or a word
976 x^2-y^3 will be read as x^2 - y^3, because items are
977 terminated by almost any nonword/nondigit char.
978 x_{i^2} or x^(2-i) braces or parenthesis do grouping.
980 Still, ambiguity is possible. So when in doubt, use {} to enclose
981 the sub/superscript. If you set this variable to the symbol `{}',
982 the braces are *required* in order to trigger interpretations as
983 sub/superscript. This can be helpful in documents that need \"_\"
984 frequently in plain text."
985 :group 'org-startup
986 :version "24.4"
987 :package-version '(Org . "8.0")
988 :type '(choice
989 (const :tag "Always interpret" t)
990 (const :tag "Only with braces" {})
991 (const :tag "Never interpret" nil)))
993 (defcustom org-startup-with-beamer-mode nil
994 "Non-nil means turn on `org-beamer-mode' on startup.
995 This can also be configured on a per-file basis by adding one of
996 the following lines anywhere in the buffer:
998 #+STARTUP: beamer"
999 :group 'org-startup
1000 :version "24.1"
1001 :type 'boolean)
1003 (defcustom org-startup-align-all-tables nil
1004 "Non-nil means align all tables when visiting a file.
1005 This is useful when the column width in tables is forced with <N> cookies
1006 in table fields. Such tables will look correct only after the first re-align.
1007 This can also be configured on a per-file basis by adding one of
1008 the following lines anywhere in the buffer:
1009 #+STARTUP: align
1010 #+STARTUP: noalign"
1011 :group 'org-startup
1012 :type 'boolean)
1014 (defcustom org-startup-with-inline-images nil
1015 "Non-nil means show inline images when loading a new Org file.
1016 This can also be configured on a per-file basis by adding one of
1017 the following lines anywhere in the buffer:
1018 #+STARTUP: inlineimages
1019 #+STARTUP: noinlineimages"
1020 :group 'org-startup
1021 :version "24.1"
1022 :type 'boolean)
1024 (defcustom org-startup-with-latex-preview nil
1025 "Non-nil means preview LaTeX fragments when loading a new Org file.
1027 This can also be configured on a per-file basis by adding one of
1028 the following lines anywhere in the buffer:
1029 #+STARTUP: latexpreview
1030 #+STARTUP: nolatexpreview"
1031 :group 'org-startup
1032 :version "24.4"
1033 :package-version '(Org . "8.0")
1034 :type 'boolean)
1036 (defcustom org-insert-mode-line-in-empty-file nil
1037 "Non-nil means insert the first line setting Org-mode in empty files.
1038 When the function `org-mode' is called interactively in an empty file, this
1039 normally means that the file name does not automatically trigger Org-mode.
1040 To ensure that the file will always be in Org-mode in the future, a
1041 line enforcing Org-mode will be inserted into the buffer, if this option
1042 has been set."
1043 :group 'org-startup
1044 :type 'boolean)
1046 (defcustom org-replace-disputed-keys nil
1047 "Non-nil means use alternative key bindings for some keys.
1048 Org-mode uses S-<cursor> keys for changing timestamps and priorities.
1049 These keys are also used by other packages like shift-selection-mode'
1050 \(built into Emacs 23), `CUA-mode' or `windmove.el'.
1051 If you want to use Org-mode together with one of these other modes,
1052 or more generally if you would like to move some Org-mode commands to
1053 other keys, set this variable and configure the keys with the variable
1054 `org-disputed-keys'.
1056 This option is only relevant at load-time of Org-mode, and must be set
1057 *before* org.el is loaded. Changing it requires a restart of Emacs to
1058 become effective."
1059 :group 'org-startup
1060 :type 'boolean)
1062 (defcustom org-use-extra-keys nil
1063 "Non-nil means use extra key sequence definitions for certain commands.
1064 This happens automatically if you run XEmacs or if `window-system'
1065 is nil. This variable lets you do the same manually. You must
1066 set it before loading org.
1068 Example: on Carbon Emacs 22 running graphically, with an external
1069 keyboard on a Powerbook, the default way of setting M-left might
1070 not work for either Alt or ESC. Setting this variable will make
1071 it work for ESC."
1072 :group 'org-startup
1073 :type 'boolean)
1075 (org-defvaralias 'org-CUA-compatible 'org-replace-disputed-keys)
1077 (defcustom org-disputed-keys
1078 '(([(shift up)] . [(meta p)])
1079 ([(shift down)] . [(meta n)])
1080 ([(shift left)] . [(meta -)])
1081 ([(shift right)] . [(meta +)])
1082 ([(control shift right)] . [(meta shift +)])
1083 ([(control shift left)] . [(meta shift -)]))
1084 "Keys for which Org-mode and other modes compete.
1085 This is an alist, cars are the default keys, second element specifies
1086 the alternative to use when `org-replace-disputed-keys' is t.
1088 Keys can be specified in any syntax supported by `define-key'.
1089 The value of this option takes effect only at Org-mode's startup,
1090 therefore you'll have to restart Emacs to apply it after changing."
1091 :group 'org-startup
1092 :type 'alist)
1094 (defun org-key (key)
1095 "Select key according to `org-replace-disputed-keys' and `org-disputed-keys'.
1096 Or return the original if not disputed.
1097 Also apply the translations defined in `org-xemacs-key-equivalents'."
1098 (when org-replace-disputed-keys
1099 (let* ((nkey (key-description key))
1100 (x (org-find-if (lambda (x)
1101 (equal (key-description (car x)) nkey))
1102 org-disputed-keys)))
1103 (setq key (if x (cdr x) key))))
1104 (when (featurep 'xemacs)
1105 (setq key (or (cdr (assoc key org-xemacs-key-equivalents)) key)))
1106 key)
1108 (defun org-find-if (predicate seq)
1109 (catch 'exit
1110 (while seq
1111 (if (funcall predicate (car seq))
1112 (throw 'exit (car seq))
1113 (pop seq)))))
1115 (defun org-defkey (keymap key def)
1116 "Define a key, possibly translated, as returned by `org-key'."
1117 (define-key keymap (org-key key) def))
1119 (defcustom org-ellipsis nil
1120 "The ellipsis to use in the Org-mode outline.
1121 When nil, just use the standard three dots.
1122 When a string, use that string instead.
1123 When a face, use the standard 3 dots, but with the specified face.
1124 The change affects only Org-mode (which will then use its own display table).
1125 Changing this requires executing \\[org-mode] in a buffer to become
1126 effective."
1127 :group 'org-startup
1128 :type '(choice (const :tag "Default" nil)
1129 (face :tag "Face" :value org-warning)
1130 (string :tag "String" :value "...#")))
1132 (defvar org-display-table nil
1133 "The display table for org-mode, in case `org-ellipsis' is non-nil.")
1135 (defgroup org-keywords nil
1136 "Keywords in Org-mode."
1137 :tag "Org Keywords"
1138 :group 'org)
1140 (defcustom org-closed-keep-when-no-todo nil
1141 "Remove CLOSED: time-stamp when switching back to a non-todo state?"
1142 :group 'org-todo
1143 :group 'org-keywords
1144 :version "24.4"
1145 :package-version '(Org . "8.0")
1146 :type 'boolean)
1148 (defgroup org-structure nil
1149 "Options concerning the general structure of Org-mode files."
1150 :tag "Org Structure"
1151 :group 'org)
1153 (defgroup org-reveal-location nil
1154 "Options about how to make context of a location visible."
1155 :tag "Org Reveal Location"
1156 :group 'org-structure)
1158 (defcustom org-show-context-detail '((isearch . lineage)
1159 (bookmark-jump . lineage)
1160 (default . ancestors))
1161 "Alist between context and visibility span when revealing a location.
1163 \\<org-mode-map>Some actions may move point into invisible
1164 locations. As a consequence, Org always expose a neighborhood
1165 around point. How much is shown depends on the initial action,
1166 or context. Valid contexts are
1168 agenda when exposing an entry from the agenda
1169 org-goto when using the command `org-goto' (\\[org-goto])
1170 occur-tree when using the command `org-occur' (\\[org-sparse-tree] /)
1171 tags-tree when constructing a sparse tree based on tags matches
1172 link-search when exposing search matches associated with a link
1173 mark-goto when exposing the jump goal of a mark
1174 bookmark-jump when exposing a bookmark location
1175 isearch when exiting from an incremental search
1176 default default for all contexts not set explicitly
1178 Allowed visibility spans are
1180 minimal show current headline; if point is not on headline,
1181 also show entry
1183 local show current headline, entry and next headline
1185 ancestors show current headline and its direct ancestors; if
1186 point is not on headline, also show entry
1188 lineage show current headline, its direct ancestors and all
1189 their children; if point is not on headline, also show
1190 entry and first child
1192 tree show current headline, its direct ancestors and all
1193 their children; if point is not on headline, also show
1194 entry and all children
1196 canonical show current headline, its direct ancestors along with
1197 their entries and children; if point is not located on
1198 the headline, also show current entry and all children
1200 As special cases, a nil or t value means show all contexts in
1201 `minimal' or `canonical' view, respectively.
1203 Some views can make displayed information very compact, but also
1204 make it harder to edit the location of the match. In such
1205 a case, use the command `org-reveal' (\\[org-reveal]) to show
1206 more context."
1207 :group 'org-reveal-location
1208 :version "25.1"
1209 :package-version '(Org . "8.3")
1210 :type '(choice
1211 (const :tag "Canonical" t)
1212 (const :tag "Minimal" nil)
1213 (repeat :greedy t :tag "Individual contexts"
1214 (cons
1215 (choice :tag "Context"
1216 (const agenda)
1217 (const org-goto)
1218 (const occur-tree)
1219 (const tags-tree)
1220 (const link-search)
1221 (const mark-goto)
1222 (const bookmark-jump)
1223 (const isearch)
1224 (const default))
1225 (choice :tag "Detail level"
1226 (const minimal)
1227 (const local)
1228 (const ancestors)
1229 (const lineage)
1230 (const tree)
1231 (const canonical))))))
1233 (defcustom org-indirect-buffer-display 'other-window
1234 "How should indirect tree buffers be displayed?
1235 This applies to indirect buffers created with the commands
1236 \\[org-tree-to-indirect-buffer] and \\[org-agenda-tree-to-indirect-buffer].
1237 Valid values are:
1238 current-window Display in the current window
1239 other-window Just display in another window.
1240 dedicated-frame Create one new frame, and re-use it each time.
1241 new-frame Make a new frame each time. Note that in this case
1242 previously-made indirect buffers are kept, and you need to
1243 kill these buffers yourself."
1244 :group 'org-structure
1245 :group 'org-agenda-windows
1246 :type '(choice
1247 (const :tag "In current window" current-window)
1248 (const :tag "In current frame, other window" other-window)
1249 (const :tag "Each time a new frame" new-frame)
1250 (const :tag "One dedicated frame" dedicated-frame)))
1252 (defcustom org-use-speed-commands nil
1253 "Non-nil means activate single letter commands at beginning of a headline.
1254 This may also be a function to test for appropriate locations where speed
1255 commands should be active.
1257 For example, to activate speed commands when the point is on any
1258 star at the beginning of the headline, you can do this:
1260 (setq org-use-speed-commands
1261 (lambda () (and (looking-at org-outline-regexp) (looking-back \"^\\**\"))))"
1262 :group 'org-structure
1263 :type '(choice
1264 (const :tag "Never" nil)
1265 (const :tag "At beginning of headline stars" t)
1266 (function)))
1268 (defcustom org-speed-commands-user nil
1269 "Alist of additional speed commands.
1270 This list will be checked before `org-speed-commands-default'
1271 when the variable `org-use-speed-commands' is non-nil
1272 and when the cursor is at the beginning of a headline.
1273 The car if each entry is a string with a single letter, which must
1274 be assigned to `self-insert-command' in the global map.
1275 The cdr is either a command to be called interactively, a function
1276 to be called, or a form to be evaluated.
1277 An entry that is just a list with a single string will be interpreted
1278 as a descriptive headline that will be added when listing the speed
1279 commands in the Help buffer using the `?' speed command."
1280 :group 'org-structure
1281 :type '(repeat :value ("k" . ignore)
1282 (choice :value ("k" . ignore)
1283 (list :tag "Descriptive Headline" (string :tag "Headline"))
1284 (cons :tag "Letter and Command"
1285 (string :tag "Command letter")
1286 (choice
1287 (function)
1288 (sexp))))))
1290 (defcustom org-bookmark-names-plist
1291 '(:last-capture "org-capture-last-stored"
1292 :last-refile "org-refile-last-stored"
1293 :last-capture-marker "org-capture-last-stored-marker")
1294 "Names for bookmarks automatically set by some Org commands.
1295 This can provide strings as names for a number of bookmarks Org sets
1296 automatically. The following keys are currently implemented:
1297 :last-capture
1298 :last-capture-marker
1299 :last-refile
1300 When a key does not show up in the property list, the corresponding bookmark
1301 is not set."
1302 :group 'org-structure
1303 :type 'plist)
1305 (defgroup org-cycle nil
1306 "Options concerning visibility cycling in Org-mode."
1307 :tag "Org Cycle"
1308 :group 'org-structure)
1310 (defcustom org-cycle-skip-children-state-if-no-children t
1311 "Non-nil means skip CHILDREN state in entries that don't have any."
1312 :group 'org-cycle
1313 :type 'boolean)
1315 (defcustom org-cycle-max-level nil
1316 "Maximum level which should still be subject to visibility cycling.
1317 Levels higher than this will, for cycling, be treated as text, not a headline.
1318 When `org-odd-levels-only' is set, a value of N in this variable actually
1319 means 2N-1 stars as the limiting headline.
1320 When nil, cycle all levels.
1321 Note that the limiting level of cycling is also influenced by
1322 `org-inlinetask-min-level'. When `org-cycle-max-level' is not set but
1323 `org-inlinetask-min-level' is, cycling will be limited to levels one less
1324 than its value."
1325 :group 'org-cycle
1326 :type '(choice
1327 (const :tag "No limit" nil)
1328 (integer :tag "Maximum level")))
1330 (defcustom org-hide-block-startup nil
1331 "Non-nil means entering Org-mode will fold all blocks.
1332 This can also be set in on a per-file basis with
1334 #+STARTUP: hideblocks
1335 #+STARTUP: showblocks"
1336 :group 'org-startup
1337 :group 'org-cycle
1338 :type 'boolean)
1340 (defcustom org-cycle-global-at-bob nil
1341 "Cycle globally if cursor is at beginning of buffer and not at a headline.
1342 This makes it possible to do global cycling without having to use S-TAB or
1343 \\[universal-argument] TAB. For this special case to work, the first line
1344 of the buffer must not be a headline -- it may be empty or some other text.
1345 When used in this way, `org-cycle-hook' is disabled temporarily to make
1346 sure the cursor stays at the beginning of the buffer. When this option is
1347 nil, don't do anything special at the beginning of the buffer."
1348 :group 'org-cycle
1349 :type 'boolean)
1351 (defcustom org-cycle-level-after-item/entry-creation t
1352 "Non-nil means cycle entry level or item indentation in new empty entries.
1354 When the cursor is at the end of an empty headline, i.e., with only stars
1355 and maybe a TODO keyword, TAB will then switch the entry to become a child,
1356 and then all possible ancestor states, before returning to the original state.
1357 This makes data entry extremely fast: M-RET to create a new headline,
1358 on TAB to make it a child, two or more tabs to make it a (grand-)uncle.
1360 When the cursor is at the end of an empty plain list item, one TAB will
1361 make it a subitem, two or more tabs will back up to make this an item
1362 higher up in the item hierarchy."
1363 :group 'org-cycle
1364 :type 'boolean)
1366 (defcustom org-cycle-emulate-tab t
1367 "Where should `org-cycle' emulate TAB.
1368 nil Never
1369 white Only in completely white lines
1370 whitestart Only at the beginning of lines, before the first non-white char
1371 t Everywhere except in headlines
1372 exc-hl-bol Everywhere except at the start of a headline
1373 If TAB is used in a place where it does not emulate TAB, the current subtree
1374 visibility is cycled."
1375 :group 'org-cycle
1376 :type '(choice (const :tag "Never" nil)
1377 (const :tag "Only in completely white lines" white)
1378 (const :tag "Before first char in a line" whitestart)
1379 (const :tag "Everywhere except in headlines" t)
1380 (const :tag "Everywhere except at bol in headlines" exc-hl-bol)))
1382 (defcustom org-cycle-separator-lines 2
1383 "Number of empty lines needed to keep an empty line between collapsed trees.
1384 If you leave an empty line between the end of a subtree and the following
1385 headline, this empty line is hidden when the subtree is folded.
1386 Org-mode will leave (exactly) one empty line visible if the number of
1387 empty lines is equal or larger to the number given in this variable.
1388 So the default 2 means at least 2 empty lines after the end of a subtree
1389 are needed to produce free space between a collapsed subtree and the
1390 following headline.
1392 If the number is negative, and the number of empty lines is at least -N,
1393 all empty lines are shown.
1395 Special case: when 0, never leave empty lines in collapsed view."
1396 :group 'org-cycle
1397 :type 'integer)
1398 (put 'org-cycle-separator-lines 'safe-local-variable 'integerp)
1400 (defcustom org-pre-cycle-hook nil
1401 "Hook that is run before visibility cycling is happening.
1402 The function(s) in this hook must accept a single argument which indicates
1403 the new state that will be set right after running this hook. The
1404 argument is a symbol. Before a global state change, it can have the values
1405 `overview', `content', or `all'. Before a local state change, it can have
1406 the values `folded', `children', or `subtree'."
1407 :group 'org-cycle
1408 :type 'hook)
1410 (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees
1411 org-cycle-hide-drawers
1412 org-cycle-show-empty-lines
1413 org-optimize-window-after-visibility-change)
1414 "Hook that is run after `org-cycle' has changed the buffer visibility.
1415 The function(s) in this hook must accept a single argument which indicates
1416 the new state that was set by the most recent `org-cycle' command. The
1417 argument is a symbol. After a global state change, it can have the values
1418 `overview', `contents', or `all'. After a local state change, it can have
1419 the values `folded', `children', or `subtree'."
1420 :group 'org-cycle
1421 :type 'hook
1422 :version "25.1"
1423 :package-version '(Org . "8.3"))
1425 (defgroup org-edit-structure nil
1426 "Options concerning structure editing in Org-mode."
1427 :tag "Org Edit Structure"
1428 :group 'org-structure)
1430 (defcustom org-odd-levels-only nil
1431 "Non-nil means skip even levels and only use odd levels for the outline.
1432 This has the effect that two stars are being added/taken away in
1433 promotion/demotion commands. It also influences how levels are
1434 handled by the exporters.
1435 Changing it requires restart of `font-lock-mode' to become effective
1436 for fontification also in regions already fontified.
1437 You may also set this on a per-file basis by adding one of the following
1438 lines to the buffer:
1440 #+STARTUP: odd
1441 #+STARTUP: oddeven"
1442 :group 'org-edit-structure
1443 :group 'org-appearance
1444 :type 'boolean)
1446 (defcustom org-adapt-indentation t
1447 "Non-nil means adapt indentation to outline node level.
1449 When this variable is set, Org assumes that you write outlines by
1450 indenting text in each node to align with the headline (after the
1451 stars). The following issues are influenced by this variable:
1453 - The indentation is increased by one space in a demotion
1454 command, and decreased by one in a promotion command. However,
1455 in the latter case, if shifting some line in the entry body
1456 would alter document structure (e.g., insert a new headline),
1457 indentation is not changed at all.
1459 - Property drawers and planning information is inserted indented
1460 when this variable is set. When nil, they will not be indented.
1462 - TAB indents a line relative to current level. The lines below
1463 a headline will be indented when this variable is set.
1465 Note that this is all about true indentation, by adding and
1466 removing space characters. See also `org-indent.el' which does
1467 level-dependent indentation in a virtual way, i.e. at display
1468 time in Emacs."
1469 :group 'org-edit-structure
1470 :type 'boolean)
1472 (defcustom org-special-ctrl-a/e nil
1473 "Non-nil means `C-a' and `C-e' behave specially in headlines and items.
1475 When t, `C-a' will bring back the cursor to the beginning of the
1476 headline text, i.e. after the stars and after a possible TODO
1477 keyword. In an item, this will be the position after bullet and
1478 check-box, if any. When the cursor is already at that position,
1479 another `C-a' will bring it to the beginning of the line.
1481 `C-e' will jump to the end of the headline, ignoring the presence
1482 of tags in the headline. A second `C-e' will then jump to the
1483 true end of the line, after any tags. This also means that, when
1484 this variable is non-nil, `C-e' also will never jump beyond the
1485 end of the heading of a folded section, i.e. not after the
1486 ellipses.
1488 When set to the symbol `reversed', the first `C-a' or `C-e' works
1489 normally, going to the true line boundary first. Only a directly
1490 following, identical keypress will bring the cursor to the
1491 special positions.
1493 This may also be a cons cell where the behavior for `C-a' and
1494 `C-e' is set separately."
1495 :group 'org-edit-structure
1496 :type '(choice
1497 (const :tag "off" nil)
1498 (const :tag "on: after stars/bullet and before tags first" t)
1499 (const :tag "reversed: true line boundary first" reversed)
1500 (cons :tag "Set C-a and C-e separately"
1501 (choice :tag "Special C-a"
1502 (const :tag "off" nil)
1503 (const :tag "on: after stars/bullet first" t)
1504 (const :tag "reversed: before stars/bullet first" reversed))
1505 (choice :tag "Special C-e"
1506 (const :tag "off" nil)
1507 (const :tag "on: before tags first" t)
1508 (const :tag "reversed: after tags first" reversed)))))
1509 (org-defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e)
1511 (defcustom org-special-ctrl-k nil
1512 "Non-nil means `C-k' will behave specially in headlines.
1513 When nil, `C-k' will call the default `kill-line' command.
1514 When t, the following will happen while the cursor is in the headline:
1516 - When the cursor is at the beginning of a headline, kill the entire
1517 line and possible the folded subtree below the line.
1518 - When in the middle of the headline text, kill the headline up to the tags.
1519 - When after the headline text, kill the tags."
1520 :group 'org-edit-structure
1521 :type 'boolean)
1523 (defcustom org-ctrl-k-protect-subtree nil
1524 "Non-nil means, do not delete a hidden subtree with C-k.
1525 When set to the symbol `error', simply throw an error when C-k is
1526 used to kill (part-of) a headline that has hidden text behind it.
1527 Any other non-nil value will result in a query to the user, if it is
1528 OK to kill that hidden subtree. When nil, kill without remorse."
1529 :group 'org-edit-structure
1530 :version "24.1"
1531 :type '(choice
1532 (const :tag "Do not protect hidden subtrees" nil)
1533 (const :tag "Protect hidden subtrees with a security query" t)
1534 (const :tag "Never kill a hidden subtree with C-k" error)))
1536 (defcustom org-special-ctrl-o t
1537 "Non-nil means, make `C-o' insert a row in tables."
1538 :group 'org-edit-structure
1539 :type 'boolean)
1541 (defcustom org-catch-invisible-edits nil
1542 "Check if in invisible region before inserting or deleting a character.
1543 Valid values are:
1545 nil Do not check, so just do invisible edits.
1546 error Throw an error and do nothing.
1547 show Make point visible, and do the requested edit.
1548 show-and-error Make point visible, then throw an error and abort the edit.
1549 smart Make point visible, and do insertion/deletion if it is
1550 adjacent to visible text and the change feels predictable.
1551 Never delete a previously invisible character or add in the
1552 middle or right after an invisible region. Basically, this
1553 allows insertion and backward-delete right before ellipses.
1554 FIXME: maybe in this case we should not even show?"
1555 :group 'org-edit-structure
1556 :version "24.1"
1557 :type '(choice
1558 (const :tag "Do not check" nil)
1559 (const :tag "Throw error when trying to edit" error)
1560 (const :tag "Unhide, but do not do the edit" show-and-error)
1561 (const :tag "Show invisible part and do the edit" show)
1562 (const :tag "Be smart and do the right thing" smart)))
1564 (defcustom org-yank-folded-subtrees t
1565 "Non-nil means when yanking subtrees, fold them.
1566 If the kill is a single subtree, or a sequence of subtrees, i.e. if
1567 it starts with a heading and all other headings in it are either children
1568 or siblings, then fold all the subtrees. However, do this only if no
1569 text after the yank would be swallowed into a folded tree by this action."
1570 :group 'org-edit-structure
1571 :type 'boolean)
1573 (defcustom org-yank-adjusted-subtrees nil
1574 "Non-nil means when yanking subtrees, adjust the level.
1575 With this setting, `org-paste-subtree' is used to insert the subtree, see
1576 this function for details."
1577 :group 'org-edit-structure
1578 :type 'boolean)
1580 (defcustom org-M-RET-may-split-line '((default . t))
1581 "Non-nil means M-RET will split the line at the cursor position.
1582 When nil, it will go to the end of the line before making a
1583 new line.
1584 You may also set this option in a different way for different
1585 contexts. Valid contexts are:
1587 headline when creating a new headline
1588 item when creating a new item
1589 table in a table field
1590 default the value to be used for all contexts not explicitly
1591 customized"
1592 :group 'org-structure
1593 :group 'org-table
1594 :type '(choice
1595 (const :tag "Always" t)
1596 (const :tag "Never" nil)
1597 (repeat :greedy t :tag "Individual contexts"
1598 (cons
1599 (choice :tag "Context"
1600 (const headline)
1601 (const item)
1602 (const table)
1603 (const default))
1604 (boolean)))))
1607 (defcustom org-insert-heading-respect-content nil
1608 "Non-nil means insert new headings after the current subtree.
1609 When nil, the new heading is created directly after the current line.
1610 The commands \\[org-insert-heading-respect-content] and \\[org-insert-todo-heading-respect-content] turn
1611 this variable on for the duration of the command."
1612 :group 'org-structure
1613 :type 'boolean)
1615 (defcustom org-blank-before-new-entry '((heading . auto)
1616 (plain-list-item . auto))
1617 "Should `org-insert-heading' leave a blank line before new heading/item?
1618 The value is an alist, with `heading' and `plain-list-item' as CAR,
1619 and a boolean flag as CDR. The cdr may also be the symbol `auto', in
1620 which case Org will look at the surrounding headings/items and try to
1621 make an intelligent decision whether to insert a blank line or not."
1622 :group 'org-edit-structure
1623 :type '(list
1624 (cons (const heading)
1625 (choice (const :tag "Never" nil)
1626 (const :tag "Always" t)
1627 (const :tag "Auto" auto)))
1628 (cons (const plain-list-item)
1629 (choice (const :tag "Never" nil)
1630 (const :tag "Always" t)
1631 (const :tag "Auto" auto)))))
1633 (defcustom org-insert-heading-hook nil
1634 "Hook being run after inserting a new heading."
1635 :group 'org-edit-structure
1636 :type 'hook)
1638 (defcustom org-enable-fixed-width-editor t
1639 "Non-nil means lines starting with \":\" are treated as fixed-width.
1640 This currently only means they are never auto-wrapped.
1641 When nil, such lines will be treated like ordinary lines."
1642 :group 'org-edit-structure
1643 :type 'boolean)
1645 (defcustom org-goto-auto-isearch t
1646 "Non-nil means typing characters in `org-goto' starts incremental search.
1647 When nil, you can use these keybindings to navigate the buffer:
1649 q Quit the org-goto interface
1650 n Go to the next visible heading
1651 p Go to the previous visible heading
1652 f Go one heading forward on same level
1653 b Go one heading backward on same level
1654 u Go one heading up"
1655 :group 'org-edit-structure
1656 :type 'boolean)
1658 (defgroup org-sparse-trees nil
1659 "Options concerning sparse trees in Org-mode."
1660 :tag "Org Sparse Trees"
1661 :group 'org-structure)
1663 (defcustom org-highlight-sparse-tree-matches t
1664 "Non-nil means highlight all matches that define a sparse tree.
1665 The highlights will automatically disappear the next time the buffer is
1666 changed by an edit command."
1667 :group 'org-sparse-trees
1668 :type 'boolean)
1670 (defcustom org-remove-highlights-with-change t
1671 "Non-nil means any change to the buffer will remove temporary highlights.
1672 \\<org-mode-map>\
1673 Such highlights are created by `org-occur' and `org-clock-display'.
1674 When nil, `\\[org-ctrl-c-ctrl-c]' needs to be used \
1675 to get rid of the highlights.
1676 The highlights created by `org-toggle-latex-fragment' always need
1677 `\\[org-toggle-latex-fragment]' to be removed."
1678 :group 'org-sparse-trees
1679 :group 'org-time
1680 :type 'boolean)
1683 (defcustom org-occur-hook '(org-first-headline-recenter)
1684 "Hook that is run after `org-occur' has constructed a sparse tree.
1685 This can be used to recenter the window to show as much of the structure
1686 as possible."
1687 :group 'org-sparse-trees
1688 :type 'hook)
1690 (defgroup org-imenu-and-speedbar nil
1691 "Options concerning imenu and speedbar in Org-mode."
1692 :tag "Org Imenu and Speedbar"
1693 :group 'org-structure)
1695 (defcustom org-imenu-depth 2
1696 "The maximum level for Imenu access to Org-mode headlines.
1697 This also applied for speedbar access."
1698 :group 'org-imenu-and-speedbar
1699 :type 'integer)
1701 (defgroup org-table nil
1702 "Options concerning tables in Org-mode."
1703 :tag "Org Table"
1704 :group 'org)
1706 (defcustom org-enable-table-editor 'optimized
1707 "Non-nil means lines starting with \"|\" are handled by the table editor.
1708 When nil, such lines will be treated like ordinary lines.
1710 When equal to the symbol `optimized', the table editor will be optimized to
1711 do the following:
1712 - Automatic overwrite mode in front of whitespace in table fields.
1713 This makes the structure of the table stay in tact as long as the edited
1714 field does not exceed the column width.
1715 - Minimize the number of realigns. Normally, the table is aligned each time
1716 TAB or RET are pressed to move to another field. With optimization this
1717 happens only if changes to a field might have changed the column width.
1718 Optimization requires replacing the functions `self-insert-command',
1719 `delete-char', and `backward-delete-char' in Org-mode buffers, with a
1720 slight (in fact: unnoticeable) speed impact for normal typing. Org-mode is
1721 very good at guessing when a re-align will be necessary, but you can always
1722 force one with \\[org-ctrl-c-ctrl-c].
1724 If you would like to use the optimized version in Org-mode, but the
1725 un-optimized version in OrgTbl-mode, see the variable `orgtbl-optimized'.
1727 This variable can be used to turn on and off the table editor during a session,
1728 but in order to toggle optimization, a restart is required.
1730 See also the variable `org-table-auto-blank-field'."
1731 :group 'org-table
1732 :type '(choice
1733 (const :tag "off" nil)
1734 (const :tag "on" t)
1735 (const :tag "on, optimized" optimized)))
1737 (defcustom org-self-insert-cluster-for-undo (or (featurep 'xemacs)
1738 (version<= emacs-version "24.1"))
1739 "Non-nil means cluster self-insert commands for undo when possible.
1740 If this is set, then, like in the Emacs command loop, 20 consecutive
1741 characters will be undone together.
1742 This is configurable, because there is some impact on typing performance."
1743 :group 'org-table
1744 :type 'boolean)
1746 (defcustom org-table-tab-recognizes-table.el t
1747 "Non-nil means TAB will automatically notice a table.el table.
1748 When it sees such a table, it moves point into it and - if necessary -
1749 calls `table-recognize-table'."
1750 :group 'org-table-editing
1751 :type 'boolean)
1753 (defgroup org-link nil
1754 "Options concerning links in Org-mode."
1755 :tag "Org Link"
1756 :group 'org)
1758 (defvar-local org-link-abbrev-alist-local nil
1759 "Buffer-local version of `org-link-abbrev-alist', which see.
1760 The value of this is taken from the #+LINK lines.")
1762 (defcustom org-link-abbrev-alist nil
1763 "Alist of link abbreviations.
1764 The car of each element is a string, to be replaced at the start of a link.
1765 The cdrs are replacement values, like (\"linkkey\" . REPLACE). Abbreviated
1766 links in Org-mode buffers can have an optional tag after a double colon, e.g.
1768 [[linkkey:tag][description]]
1770 The `linkkey' must be a word word, starting with a letter, followed
1771 by letters, numbers, `-' or `_'.
1773 If REPLACE is a string, the tag will simply be appended to create the link.
1774 If the string contains \"%s\", the tag will be inserted there. If the string
1775 contains \"%h\", it will cause a url-encoded version of the tag to be inserted
1776 at that point (see the function `url-hexify-string'). If the string contains
1777 the specifier \"%(my-function)\", then the custom function `my-function' will
1778 be invoked: this function takes the tag as its only argument and must return
1779 a string.
1781 REPLACE may also be a function that will be called with the tag as the
1782 only argument to create the link, which should be returned as a string.
1784 See the manual for examples."
1785 :group 'org-link
1786 :type '(repeat
1787 (cons
1788 (string :tag "Protocol")
1789 (choice
1790 (string :tag "Format")
1791 (function)))))
1793 (defcustom org-descriptive-links t
1794 "Non-nil means Org will display descriptive links.
1795 E.g. [[http://orgmode.org][Org website]] will be displayed as
1796 \"Org Website\", hiding the link itself and just displaying its
1797 description. When set to nil, Org will display the full links
1798 literally.
1800 You can interactively set the value of this variable by calling
1801 `org-toggle-link-display' or from the menu Org>Hyperlinks menu."
1802 :group 'org-link
1803 :type 'boolean)
1805 (defcustom org-link-file-path-type 'adaptive
1806 "How the path name in file links should be stored.
1807 Valid values are:
1809 relative Relative to the current directory, i.e. the directory of the file
1810 into which the link is being inserted.
1811 absolute Absolute path, if possible with ~ for home directory.
1812 noabbrev Absolute path, no abbreviation of home directory.
1813 adaptive Use relative path for files in the current directory and sub-
1814 directories of it. For other files, use an absolute path."
1815 :group 'org-link
1816 :type '(choice
1817 (const relative)
1818 (const absolute)
1819 (const noabbrev)
1820 (const adaptive)))
1822 (defvaralias 'org-activate-links 'org-highlight-links)
1823 (defcustom org-highlight-links '(bracket angle plain radio tag date footnote)
1824 "Types of links that should be highlighted in Org-mode files.
1826 This is a list of symbols, each one of them leading to the
1827 highlighting of a certain link type.
1829 You can still open links that are not highlighted.
1831 In principle, it does not hurt to turn on highlighting for all
1832 link types. There may be a small gain when turning off unused
1833 link types. The types are:
1835 bracket The recommended [[link][description]] or [[link]] links with hiding.
1836 angle Links in angular brackets that may contain whitespace like
1837 <bbdb:Carsten Dominik>.
1838 plain Plain links in normal text, no whitespace, like http://google.com.
1839 radio Text that is matched by a radio target, see manual for details.
1840 tag Tag settings in a headline (link to tag search).
1841 date Time stamps (link to calendar).
1842 footnote Footnote labels.
1844 If you set this variable during an Emacs session, use `org-mode-restart'
1845 in the Org buffer so that the change takes effect."
1846 :group 'org-link
1847 :group 'org-appearance
1848 :type '(set :greedy t
1849 (const :tag "Double bracket links" bracket)
1850 (const :tag "Angular bracket links" angle)
1851 (const :tag "Plain text links" plain)
1852 (const :tag "Radio target matches" radio)
1853 (const :tag "Tags" tag)
1854 (const :tag "Timestamps" date)
1855 (const :tag "Footnotes" footnote)))
1857 (defcustom org-make-link-description-function nil
1858 "Function to use for generating link descriptions from links.
1859 When nil, the link location will be used. This function must take
1860 two parameters: the first one is the link, the second one is the
1861 description generated by `org-insert-link'. The function should
1862 return the description to use."
1863 :group 'org-link
1864 :type '(choice (const nil) (function)))
1866 (defgroup org-link-store nil
1867 "Options concerning storing links in Org-mode."
1868 :tag "Org Store Link"
1869 :group 'org-link)
1871 (defcustom org-url-hexify-p t
1872 "When non-nil, hexify URL when creating a link."
1873 :type 'boolean
1874 :version "24.3"
1875 :group 'org-link-store)
1877 (defcustom org-email-link-description-format "Email %c: %.30s"
1878 "Format of the description part of a link to an email or usenet message.
1879 The following %-escapes will be replaced by corresponding information:
1881 %F full \"From\" field
1882 %f name, taken from \"From\" field, address if no name
1883 %T full \"To\" field
1884 %t first name in \"To\" field, address if no name
1885 %c correspondent. Usually \"from NAME\", but if you sent it yourself, it
1886 will be \"to NAME\". See also the variable `org-from-is-user-regexp'.
1887 %s subject
1888 %d date
1889 %m message-id.
1891 You may use normal field width specification between the % and the letter.
1892 This is for example useful to limit the length of the subject.
1894 Examples: \"%f on: %.30s\", \"Email from %f\", \"Email %c\""
1895 :group 'org-link-store
1896 :type 'string)
1898 (defcustom org-from-is-user-regexp
1899 (let (r1 r2)
1900 (when (and user-mail-address (not (string= user-mail-address "")))
1901 (setq r1 (concat "\\<" (regexp-quote user-mail-address) "\\>")))
1902 (when (and user-full-name (not (string= user-full-name "")))
1903 (setq r2 (concat "\\<" (regexp-quote user-full-name) "\\>")))
1904 (if (and r1 r2) (concat r1 "\\|" r2) (or r1 r2)))
1905 "Regexp matched against the \"From:\" header of an email or usenet message.
1906 It should match if the message is from the user him/herself."
1907 :group 'org-link-store
1908 :type 'regexp)
1910 (defcustom org-context-in-file-links t
1911 "Non-nil means file links from `org-store-link' contain context.
1912 A search string will be added to the file name with :: as separator and
1913 used to find the context when the link is activated by the command
1914 `org-open-at-point'. When this option is t, the entire active region
1915 will be placed in the search string of the file link. If set to a
1916 positive integer, only the first n lines of context will be stored.
1918 Using a prefix arg to the command \\[org-store-link] (`org-store-link')
1919 negates this setting for the duration of the command."
1920 :group 'org-link-store
1921 :type '(choice boolean integer))
1923 (defcustom org-keep-stored-link-after-insertion nil
1924 "Non-nil means keep link in list for entire session.
1926 The command `org-store-link' adds a link pointing to the current
1927 location to an internal list. These links accumulate during a session.
1928 The command `org-insert-link' can be used to insert links into any
1929 Org-mode file (offering completion for all stored links). When this
1930 option is nil, every link which has been inserted once using \\[org-insert-link]
1931 will be removed from the list, to make completing the unused links
1932 more efficient."
1933 :group 'org-link-store
1934 :type 'boolean)
1936 (defgroup org-link-follow nil
1937 "Options concerning following links in Org-mode."
1938 :tag "Org Follow Link"
1939 :group 'org-link)
1941 (defcustom org-link-translation-function nil
1942 "Function to translate links with different syntax to Org syntax.
1943 This can be used to translate links created for example by the Planner
1944 or emacs-wiki packages to Org syntax.
1945 The function must accept two parameters, a TYPE containing the link
1946 protocol name like \"rmail\" or \"gnus\" as a string, and the linked path,
1947 which is everything after the link protocol. It should return a cons
1948 with possibly modified values of type and path.
1949 Org contains a function for this, so if you set this variable to
1950 `org-translate-link-from-planner', you should be able follow many
1951 links created by planner."
1952 :group 'org-link-follow
1953 :type '(choice (const nil) (function)))
1955 (defcustom org-follow-link-hook nil
1956 "Hook that is run after a link has been followed."
1957 :group 'org-link-follow
1958 :type 'hook)
1960 (defcustom org-tab-follows-link nil
1961 "Non-nil means on links TAB will follow the link.
1962 Needs to be set before org.el is loaded.
1963 This really should not be used, it does not make sense, and the
1964 implementation is bad."
1965 :group 'org-link-follow
1966 :type 'boolean)
1968 (defcustom org-return-follows-link nil
1969 "Non-nil means on links RET will follow the link.
1970 In tables, the special behavior of RET has precedence."
1971 :group 'org-link-follow
1972 :type 'boolean)
1974 (defcustom org-mouse-1-follows-link
1975 (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t)
1976 "Non-nil means mouse-1 on a link will follow the link.
1977 A longer mouse click will still set point. Does not work on XEmacs.
1978 Needs to be set before org.el is loaded."
1979 :group 'org-link-follow
1980 :version "24.4"
1981 :package-version '(Org . "8.3")
1982 :type '(choice
1983 (const :tag "A double click follows the link" double)
1984 (const :tag "Unconditionally follow the link with mouse-1" t)
1985 (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450)))
1987 (defcustom org-mark-ring-length 4
1988 "Number of different positions to be recorded in the ring.
1989 Changing this requires a restart of Emacs to work correctly."
1990 :group 'org-link-follow
1991 :type 'integer)
1993 (defcustom org-link-search-must-match-exact-headline 'query-to-create
1994 "Non-nil means internal links in Org files must exactly match a headline.
1995 When nil, the link search tries to match a phrase with all words
1996 in the search text."
1997 :group 'org-link-follow
1998 :version "24.1"
1999 :type '(choice
2000 (const :tag "Use fuzzy text search" nil)
2001 (const :tag "Match only exact headline" t)
2002 (const :tag "Match exact headline or query to create it"
2003 query-to-create)))
2005 (defcustom org-link-frame-setup
2006 '((vm . vm-visit-folder-other-frame)
2007 (vm-imap . vm-visit-imap-folder-other-frame)
2008 (gnus . org-gnus-no-new-news)
2009 (file . find-file-other-window)
2010 (wl . wl-other-frame))
2011 "Setup the frame configuration for following links.
2012 When following a link with Emacs, it may often be useful to display
2013 this link in another window or frame. This variable can be used to
2014 set this up for the different types of links.
2015 For VM, use any of
2016 `vm-visit-folder'
2017 `vm-visit-folder-other-window'
2018 `vm-visit-folder-other-frame'
2019 For Gnus, use any of
2020 `gnus'
2021 `gnus-other-frame'
2022 `org-gnus-no-new-news'
2023 For FILE, use any of
2024 `find-file'
2025 `find-file-other-window'
2026 `find-file-other-frame'
2027 For Wanderlust use any of
2028 `wl'
2029 `wl-other-frame'
2030 For the calendar, use the variable `calendar-setup'.
2031 For BBDB, it is currently only possible to display the matches in
2032 another window."
2033 :group 'org-link-follow
2034 :type '(list
2035 (cons (const vm)
2036 (choice
2037 (const vm-visit-folder)
2038 (const vm-visit-folder-other-window)
2039 (const vm-visit-folder-other-frame)))
2040 (cons (const vm-imap)
2041 (choice
2042 (const vm-visit-imap-folder)
2043 (const vm-visit-imap-folder-other-window)
2044 (const vm-visit-imap-folder-other-frame)))
2045 (cons (const gnus)
2046 (choice
2047 (const gnus)
2048 (const gnus-other-frame)
2049 (const org-gnus-no-new-news)))
2050 (cons (const file)
2051 (choice
2052 (const find-file)
2053 (const find-file-other-window)
2054 (const find-file-other-frame)))
2055 (cons (const wl)
2056 (choice
2057 (const wl)
2058 (const wl-other-frame)))))
2060 (defcustom org-display-internal-link-with-indirect-buffer nil
2061 "Non-nil means use indirect buffer to display infile links.
2062 Activating internal links (from one location in a file to another location
2063 in the same file) normally just jumps to the location. When the link is
2064 activated with a \\[universal-argument] prefix (or with mouse-3), the link \
2065 is displayed in
2066 another window. When this option is set, the other window actually displays
2067 an indirect buffer clone of the current buffer, to avoid any visibility
2068 changes to the current buffer."
2069 :group 'org-link-follow
2070 :type 'boolean)
2072 (defcustom org-open-non-existing-files nil
2073 "Non-nil means `org-open-file' will open non-existing files.
2074 When nil, an error will be generated.
2075 This variable applies only to external applications because they
2076 might choke on non-existing files. If the link is to a file that
2077 will be opened in Emacs, the variable is ignored."
2078 :group 'org-link-follow
2079 :type 'boolean)
2081 (defcustom org-open-directory-means-index-dot-org nil
2082 "Non-nil means a link to a directory really means to index.org.
2083 When nil, following a directory link will run dired or open a finder/explorer
2084 window on that directory."
2085 :group 'org-link-follow
2086 :type 'boolean)
2088 (defcustom org-confirm-shell-link-function 'yes-or-no-p
2089 "Non-nil means ask for confirmation before executing shell links.
2090 Shell links can be dangerous: just think about a link
2092 [[shell:rm -rf ~/*][Google Search]]
2094 This link would show up in your Org-mode document as \"Google Search\",
2095 but really it would remove your entire home directory.
2096 Therefore we advise against setting this variable to nil.
2097 Just change it to `y-or-n-p' if you want to confirm with a
2098 single keystroke rather than having to type \"yes\"."
2099 :group 'org-link-follow
2100 :type '(choice
2101 (const :tag "with yes-or-no (safer)" yes-or-no-p)
2102 (const :tag "with y-or-n (faster)" y-or-n-p)
2103 (const :tag "no confirmation (dangerous)" nil)))
2104 (put 'org-confirm-shell-link-function
2105 'safe-local-variable
2106 (lambda (x) (member x '(yes-or-no-p y-or-n-p))))
2108 (defcustom org-confirm-shell-link-not-regexp ""
2109 "A regexp to skip confirmation for shell links."
2110 :group 'org-link-follow
2111 :version "24.1"
2112 :type 'regexp)
2114 (defcustom org-confirm-elisp-link-function 'yes-or-no-p
2115 "Non-nil means ask for confirmation before executing Emacs Lisp links.
2116 Elisp links can be dangerous: just think about a link
2118 [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]]
2120 This link would show up in your Org-mode document as \"Google Search\",
2121 but really it would remove your entire home directory.
2122 Therefore we advise against setting this variable to nil.
2123 Just change it to `y-or-n-p' if you want to confirm with a
2124 single keystroke rather than having to type \"yes\"."
2125 :group 'org-link-follow
2126 :type '(choice
2127 (const :tag "with yes-or-no (safer)" yes-or-no-p)
2128 (const :tag "with y-or-n (faster)" y-or-n-p)
2129 (const :tag "no confirmation (dangerous)" nil)))
2130 (put 'org-confirm-shell-link-function
2131 'safe-local-variable
2132 (lambda (x) (member x '(yes-or-no-p y-or-n-p))))
2134 (defcustom org-confirm-elisp-link-not-regexp ""
2135 "A regexp to skip confirmation for Elisp links."
2136 :group 'org-link-follow
2137 :version "24.1"
2138 :type 'regexp)
2140 (defconst org-file-apps-defaults-gnu
2141 '((remote . emacs)
2142 (system . mailcap)
2143 (t . mailcap))
2144 "Default file applications on a UNIX or GNU/Linux system.
2145 See `org-file-apps'.")
2147 (defconst org-file-apps-defaults-macosx
2148 '((remote . emacs)
2149 (t . "open %s")
2150 (system . "open %s")
2151 ("ps.gz" . "gv %s")
2152 ("eps.gz" . "gv %s")
2153 ("dvi" . "xdvi %s")
2154 ("fig" . "xfig %s"))
2155 "Default file applications on a MacOS X system.
2156 The system \"open\" is known as a default, but we use X11 applications
2157 for some files for which the OS does not have a good default.
2158 See `org-file-apps'.")
2160 (defconst org-file-apps-defaults-windowsnt
2161 (list
2162 '(remote . emacs)
2163 (cons t
2164 (list (if (featurep 'xemacs)
2165 'mswindows-shell-execute
2166 'w32-shell-execute)
2167 "open" 'file))
2168 (cons 'system
2169 (list (if (featurep 'xemacs)
2170 'mswindows-shell-execute
2171 'w32-shell-execute)
2172 "open" 'file)))
2173 "Default file applications on a Windows NT system.
2174 The system \"open\" is used for most files.
2175 See `org-file-apps'.")
2177 (defcustom org-file-apps
2178 '((auto-mode . emacs)
2179 ("\\.mm\\'" . default)
2180 ("\\.x?html?\\'" . default)
2181 ("\\.pdf\\'" . default))
2182 "External applications for opening `file:path' items in a document.
2183 Org-mode uses system defaults for different file types, but
2184 you can use this variable to set the application for a given file
2185 extension. The entries in this list are cons cells where the car identifies
2186 files and the cdr the corresponding command. Possible values for the
2187 file identifier are
2188 \"string\" A string as a file identifier can be interpreted in different
2189 ways, depending on its contents:
2191 - Alphanumeric characters only:
2192 Match links with this file extension.
2193 Example: (\"pdf\" . \"evince %s\")
2194 to open PDFs with evince.
2196 - Regular expression: Match links where the
2197 filename matches the regexp. If you want to
2198 use groups here, use shy groups.
2200 Example: (\"\\.x?html\\\\='\" . \"firefox %s\")
2201 (\"\\(?:xhtml\\|html\\)\" . \"firefox %s\")
2202 to open *.html and *.xhtml with firefox.
2204 - Regular expression which contains (non-shy) groups:
2205 Match links where the whole link, including \"::\", and
2206 anything after that, matches the regexp.
2207 In a custom command string, %1, %2, etc. are replaced with
2208 the parts of the link that were matched by the groups.
2209 For backwards compatibility, if a command string is given
2210 that does not use any of the group matches, this case is
2211 handled identically to the second one (i.e. match against
2212 file name only).
2213 In a custom lisp form, you can access the group matches with
2214 (match-string n link).
2216 Example: (\"\\.pdf::\\(\\d+\\)\\\\='\" . \"evince -p %1 %s\")
2217 to open [[file:document.pdf::5]] with evince at page 5.
2219 `directory' Matches a directory
2220 `remote' Matches a remote file, accessible through tramp or efs.
2221 Remote files most likely should be visited through Emacs
2222 because external applications cannot handle such paths.
2223 `auto-mode' Matches files that are matched by any entry in `auto-mode-alist',
2224 so all files Emacs knows how to handle. Using this with
2225 command `emacs' will open most files in Emacs. Beware that this
2226 will also open html files inside Emacs, unless you add
2227 (\"html\" . default) to the list as well.
2228 t Default for files not matched by any of the other options.
2229 `system' The system command to open files, like `open' on Windows
2230 and Mac OS X, and mailcap under GNU/Linux. This is the command
2231 that will be selected if you call `C-c C-o' with a double
2232 \\[universal-argument] \\[universal-argument] prefix.
2234 Possible values for the command are:
2235 `emacs' The file will be visited by the current Emacs process.
2236 `default' Use the default application for this file type, which is the
2237 association for t in the list, most likely in the system-specific
2238 part.
2239 This can be used to overrule an unwanted setting in the
2240 system-specific variable.
2241 `system' Use the system command for opening files, like \"open\".
2242 This command is specified by the entry whose car is `system'.
2243 Most likely, the system-specific version of this variable
2244 does define this command, but you can overrule/replace it
2245 here.
2246 string A command to be executed by a shell; %s will be replaced
2247 by the path to the file.
2248 sexp A Lisp form which will be evaluated. The file path will
2249 be available in the Lisp variable `file'.
2250 For more examples, see the system specific constants
2251 `org-file-apps-defaults-macosx'
2252 `org-file-apps-defaults-windowsnt'
2253 `org-file-apps-defaults-gnu'."
2254 :group 'org-link-follow
2255 :type '(repeat
2256 (cons (choice :value ""
2257 (string :tag "Extension")
2258 (const :tag "System command to open files" system)
2259 (const :tag "Default for unrecognized files" t)
2260 (const :tag "Remote file" remote)
2261 (const :tag "Links to a directory" directory)
2262 (const :tag "Any files that have Emacs modes"
2263 auto-mode))
2264 (choice :value ""
2265 (const :tag "Visit with Emacs" emacs)
2266 (const :tag "Use default" default)
2267 (const :tag "Use the system command" system)
2268 (string :tag "Command")
2269 (sexp :tag "Lisp form")))))
2271 (defcustom org-doi-server-url "http://dx.doi.org/"
2272 "The URL of the DOI server."
2273 :type 'string
2274 :version "24.3"
2275 :group 'org-link-follow)
2277 (defgroup org-refile nil
2278 "Options concerning refiling entries in Org-mode."
2279 :tag "Org Refile"
2280 :group 'org)
2282 (defcustom org-directory "~/org"
2283 "Directory with org files.
2284 This is just a default location to look for Org files. There is no need
2285 at all to put your files into this directory. It is only used in the
2286 following situations:
2288 1. When a capture template specifies a target file that is not an
2289 absolute path. The path will then be interpreted relative to
2290 `org-directory'
2291 2. When a capture note is filed away in an interactive way (when exiting the
2292 note buffer with `C-1 C-c C-c'. The user is prompted for an org file,
2293 with `org-directory' as the default path."
2294 :group 'org-refile
2295 :group 'org-capture
2296 :type 'directory)
2298 (defcustom org-default-notes-file (convert-standard-filename "~/.notes")
2299 "Default target for storing notes.
2300 Used as a fall back file for org-capture.el, for templates that
2301 do not specify a target file."
2302 :group 'org-refile
2303 :group 'org-capture
2304 :type 'file)
2306 (defcustom org-goto-interface 'outline
2307 "The default interface to be used for `org-goto'.
2308 Allowed values are:
2309 outline The interface shows an outline of the relevant file
2310 and the correct heading is found by moving through
2311 the outline or by searching with incremental search.
2312 outline-path-completion Headlines in the current buffer are offered via
2313 completion. This is the interface also used by
2314 the refile command."
2315 :group 'org-refile
2316 :type '(choice
2317 (const :tag "Outline" outline)
2318 (const :tag "Outline-path-completion" outline-path-completion)))
2320 (defcustom org-goto-max-level 5
2321 "Maximum target level when running `org-goto' with refile interface."
2322 :group 'org-refile
2323 :type 'integer)
2325 (defcustom org-reverse-note-order nil
2326 "Non-nil means store new notes at the beginning of a file or entry.
2327 When nil, new notes will be filed to the end of a file or entry.
2328 This can also be a list with cons cells of regular expressions that
2329 are matched against file names, and values."
2330 :group 'org-capture
2331 :group 'org-refile
2332 :type '(choice
2333 (const :tag "Reverse always" t)
2334 (const :tag "Reverse never" nil)
2335 (repeat :tag "By file name regexp"
2336 (cons regexp boolean))))
2338 (defcustom org-log-refile nil
2339 "Information to record when a task is refiled.
2341 Possible values are:
2343 nil Don't add anything
2344 time Add a time stamp to the task
2345 note Prompt for a note and add it with template `org-log-note-headings'
2347 This option can also be set with on a per-file-basis with
2349 #+STARTUP: nologrefile
2350 #+STARTUP: logrefile
2351 #+STARTUP: lognoterefile
2353 You can have local logging settings for a subtree by setting the LOGGING
2354 property to one or more of these keywords.
2356 When bulk-refiling from the agenda, the value `note' is forbidden and
2357 will temporarily be changed to `time'."
2358 :group 'org-refile
2359 :group 'org-progress
2360 :version "24.1"
2361 :type '(choice
2362 (const :tag "No logging" nil)
2363 (const :tag "Record timestamp" time)
2364 (const :tag "Record timestamp with note." note)))
2366 (defcustom org-refile-targets nil
2367 "Targets for refiling entries with \\[org-refile].
2368 This is a list of cons cells. Each cell contains:
2369 - a specification of the files to be considered, either a list of files,
2370 or a symbol whose function or variable value will be used to retrieve
2371 a file name or a list of file names. If you use `org-agenda-files' for
2372 that, all agenda files will be scanned for targets. Nil means consider
2373 headings in the current buffer.
2374 - A specification of how to find candidate refile targets. This may be
2375 any of:
2376 - a cons cell (:tag . \"TAG\") to identify refile targets by a tag.
2377 This tag has to be present in all target headlines, inheritance will
2378 not be considered.
2379 - a cons cell (:todo . \"KEYWORD\") to identify refile targets by
2380 todo keyword.
2381 - a cons cell (:regexp . \"REGEXP\") with a regular expression matching
2382 headlines that are refiling targets.
2383 - a cons cell (:level . N). Any headline of level N is considered a target.
2384 Note that, when `org-odd-levels-only' is set, level corresponds to
2385 order in hierarchy, not to the number of stars.
2386 - a cons cell (:maxlevel . N). Any headline with level <= N is a target.
2387 Note that, when `org-odd-levels-only' is set, level corresponds to
2388 order in hierarchy, not to the number of stars.
2390 Each element of this list generates a set of possible targets.
2391 The union of these sets is presented (with completion) to
2392 the user by `org-refile'.
2394 You can set the variable `org-refile-target-verify-function' to a function
2395 to verify each headline found by the simple criteria above.
2397 When this variable is nil, all top-level headlines in the current buffer
2398 are used, equivalent to the value `((nil . (:level . 1))'."
2399 :group 'org-refile
2400 :type '(repeat
2401 (cons
2402 (choice :value org-agenda-files
2403 (const :tag "All agenda files" org-agenda-files)
2404 (const :tag "Current buffer" nil)
2405 (function) (variable) (file))
2406 (choice :tag "Identify target headline by"
2407 (cons :tag "Specific tag" (const :value :tag) (string))
2408 (cons :tag "TODO keyword" (const :value :todo) (string))
2409 (cons :tag "Regular expression" (const :value :regexp) (regexp))
2410 (cons :tag "Level number" (const :value :level) (integer))
2411 (cons :tag "Max Level number" (const :value :maxlevel) (integer))))))
2413 (defcustom org-refile-target-verify-function nil
2414 "Function to verify if the headline at point should be a refile target.
2415 The function will be called without arguments, with point at the
2416 beginning of the headline. It should return t and leave point
2417 where it is if the headline is a valid target for refiling.
2419 If the target should not be selected, the function must return nil.
2420 In addition to this, it may move point to a place from where the search
2421 should be continued. For example, the function may decide that the entire
2422 subtree of the current entry should be excluded and move point to the end
2423 of the subtree."
2424 :group 'org-refile
2425 :type '(choice
2426 (const nil)
2427 (function)))
2429 (defcustom org-refile-use-cache nil
2430 "Non-nil means cache refile targets to speed up the process.
2431 \\<org-mode-map>\
2432 The cache for a particular file will be updated automatically when
2433 the buffer has been killed, or when any of the marker used for flagging
2434 refile targets no longer points at a live buffer.
2435 If you have added new entries to a buffer that might themselves be targets,
2436 you need to clear the cache manually by pressing `C-0 \\[org-refile]' or,
2437 if you find that easier, \
2438 `\\[universal-argument] \\[universal-argument] \\[universal-argument] \
2439 \\[org-refile]'."
2440 :group 'org-refile
2441 :version "24.1"
2442 :type 'boolean)
2444 (defcustom org-refile-use-outline-path nil
2445 "Non-nil means provide refile targets as paths.
2446 So a level 3 headline will be available as level1/level2/level3.
2448 When the value is `file', also include the file name (without directory)
2449 into the path. In this case, you can also stop the completion after
2450 the file name, to get entries inserted as top level in the file.
2452 When `full-file-path', include the full file path."
2453 :group 'org-refile
2454 :type '(choice
2455 (const :tag "Not" nil)
2456 (const :tag "Yes" t)
2457 (const :tag "Start with file name" file)
2458 (const :tag "Start with full file path" full-file-path)))
2460 (defcustom org-outline-path-complete-in-steps t
2461 "Non-nil means complete the outline path in hierarchical steps.
2462 When Org-mode uses the refile interface to select an outline path
2463 \(see variable `org-refile-use-outline-path'), the completion of
2464 the path can be done in a single go, or it can be done in steps down
2465 the headline hierarchy. Going in steps is probably the best if you
2466 do not use a special completion package like `ido' or `icicles'.
2467 However, when using these packages, going in one step can be very
2468 fast, while still showing the whole path to the entry."
2469 :group 'org-refile
2470 :type 'boolean)
2472 (defcustom org-refile-allow-creating-parent-nodes nil
2473 "Non-nil means allow to create new nodes as refile targets.
2474 New nodes are then created by adding \"/new node name\" to the completion
2475 of an existing node. When the value of this variable is `confirm',
2476 new node creation must be confirmed by the user (recommended).
2477 When nil, the completion must match an existing entry.
2479 Note that, if the new heading is not seen by the criteria
2480 listed in `org-refile-targets', multiple instances of the same
2481 heading would be created by trying again to file under the new
2482 heading."
2483 :group 'org-refile
2484 :type '(choice
2485 (const :tag "Never" nil)
2486 (const :tag "Always" t)
2487 (const :tag "Prompt for confirmation" confirm)))
2489 (defcustom org-refile-active-region-within-subtree nil
2490 "Non-nil means also refile active region within a subtree.
2492 By default `org-refile' doesn't allow refiling regions if they
2493 don't contain a set of subtrees, but it might be convenient to
2494 do so sometimes: in that case, the first line of the region is
2495 converted to a headline before refiling."
2496 :group 'org-refile
2497 :version "24.1"
2498 :type 'boolean)
2500 (defgroup org-todo nil
2501 "Options concerning TODO items in Org-mode."
2502 :tag "Org TODO"
2503 :group 'org)
2505 (defgroup org-progress nil
2506 "Options concerning Progress logging in Org-mode."
2507 :tag "Org Progress"
2508 :group 'org-time)
2510 (defvar org-todo-interpretation-widgets
2511 '((:tag "Sequence (cycling hits every state)" sequence)
2512 (:tag "Type (cycling directly to DONE)" type))
2513 "The available interpretation symbols for customizing `org-todo-keywords'.
2514 Interested libraries should add to this list.")
2516 (defcustom org-todo-keywords '((sequence "TODO" "DONE"))
2517 "List of TODO entry keyword sequences and their interpretation.
2518 \\<org-mode-map>This is a list of sequences.
2520 Each sequence starts with a symbol, either `sequence' or `type',
2521 indicating if the keywords should be interpreted as a sequence of
2522 action steps, or as different types of TODO items. The first
2523 keywords are states requiring action - these states will select a headline
2524 for inclusion into the global TODO list Org-mode produces. If one of
2525 the \"keywords\" is the vertical bar, \"|\", the remaining keywords
2526 signify that no further action is necessary. If \"|\" is not found,
2527 the last keyword is treated as the only DONE state of the sequence.
2529 The command \\[org-todo] cycles an entry through these states, and one
2530 additional state where no keyword is present. For details about this
2531 cycling, see the manual.
2533 TODO keywords and interpretation can also be set on a per-file basis with
2534 the special #+SEQ_TODO and #+TYP_TODO lines.
2536 Each keyword can optionally specify a character for fast state selection
2537 \(in combination with the variable `org-use-fast-todo-selection')
2538 and specifiers for state change logging, using the same syntax that
2539 is used in the \"#+TODO:\" lines. For example, \"WAIT(w)\" says that
2540 the WAIT state can be selected with the \"w\" key. \"WAIT(w!)\"
2541 indicates to record a time stamp each time this state is selected.
2543 Each keyword may also specify if a timestamp or a note should be
2544 recorded when entering or leaving the state, by adding additional
2545 characters in the parenthesis after the keyword. This looks like this:
2546 \"WAIT(w@/!)\". \"@\" means to add a note (with time), \"!\" means to
2547 record only the time of the state change. With X and Y being either
2548 \"@\" or \"!\", \"X/Y\" means use X when entering the state, and use
2549 Y when leaving the state if and only if the *target* state does not
2550 define X. You may omit any of the fast-selection key or X or /Y,
2551 so WAIT(w@), WAIT(w/@) and WAIT(@/@) are all valid.
2553 For backward compatibility, this variable may also be just a list
2554 of keywords. In this case the interpretation (sequence or type) will be
2555 taken from the (otherwise obsolete) variable `org-todo-interpretation'."
2556 :group 'org-todo
2557 :group 'org-keywords
2558 :type '(choice
2559 (repeat :tag "Old syntax, just keywords"
2560 (string :tag "Keyword"))
2561 (repeat :tag "New syntax"
2562 (cons
2563 (choice
2564 :tag "Interpretation"
2565 ;;Quick and dirty way to see
2566 ;;`org-todo-interpretations'. This takes the
2567 ;;place of item arguments
2568 :convert-widget
2569 (lambda (widget)
2570 (widget-put widget
2571 :args (mapcar
2572 (lambda (x)
2573 (widget-convert
2574 (cons 'const x)))
2575 org-todo-interpretation-widgets))
2576 widget))
2577 (repeat
2578 (string :tag "Keyword"))))))
2580 (defvar-local org-todo-keywords-1 nil
2581 "All TODO and DONE keywords active in a buffer.")
2582 (defvar org-todo-keywords-for-agenda nil)
2583 (defvar org-done-keywords-for-agenda nil)
2584 (defvar org-todo-keyword-alist-for-agenda nil)
2585 (defvar org-tag-alist-for-agenda nil
2586 "Alist of all tags from all agenda files.")
2587 (defvar org-tag-groups-alist-for-agenda nil
2588 "Alist of all groups tags from all current agenda files.")
2589 (defvar-local org-tag-groups-alist nil)
2590 (defvar org-agenda-contributing-files nil)
2591 (defvar-local org-not-done-keywords nil)
2592 (defvar-local org-done-keywords nil)
2593 (defvar-local org-todo-heads nil)
2594 (defvar-local org-todo-sets nil)
2595 (defvar-local org-todo-log-states nil)
2596 (defvar-local org-todo-kwd-alist nil)
2597 (defvar-local org-todo-key-alist nil)
2598 (defvar-local org-todo-key-trigger nil)
2600 (defcustom org-todo-interpretation 'sequence
2601 "Controls how TODO keywords are interpreted.
2602 This variable is in principle obsolete and is only used for
2603 backward compatibility, if the interpretation of todo keywords is
2604 not given already in `org-todo-keywords'. See that variable for
2605 more information."
2606 :group 'org-todo
2607 :group 'org-keywords
2608 :type '(choice (const sequence)
2609 (const type)))
2611 (defcustom org-use-fast-todo-selection t
2612 "\\<org-mode-map>\
2613 Non-nil means use the fast todo selection scheme with \\[org-todo].
2614 This variable describes if and under what circumstances the cycling
2615 mechanism for TODO keywords will be replaced by a single-key, direct
2616 selection scheme.
2618 When nil, fast selection is never used.
2620 When the symbol `prefix', it will be used when `org-todo' is called
2621 with a prefix argument, i.e. `\\[universal-argument] \\[org-todo]' \
2622 in an Org-mode buffer, and
2623 `\\[universal-argument] t' in an agenda buffer.
2625 When t, fast selection is used by default. In this case, the prefix
2626 argument forces cycling instead.
2628 In all cases, the special interface is only used if access keys have
2629 actually been assigned by the user, i.e. if keywords in the configuration
2630 are followed by a letter in parenthesis, like TODO(t)."
2631 :group 'org-todo
2632 :type '(choice
2633 (const :tag "Never" nil)
2634 (const :tag "By default" t)
2635 (const :tag "Only with C-u C-c C-t" prefix)))
2637 (defcustom org-provide-todo-statistics t
2638 "Non-nil means update todo statistics after insert and toggle.
2639 ALL-HEADLINES means update todo statistics by including headlines
2640 with no TODO keyword as well, counting them as not done.
2641 A list of TODO keywords means the same, but skip keywords that are
2642 not in this list.
2643 When set to a list of two lists, the first list contains keywords
2644 to consider as TODO keywords, the second list contains keywords
2645 to consider as DONE keywords.
2647 When this is set, todo statistics is updated in the parent of the
2648 current entry each time a todo state is changed."
2649 :group 'org-todo
2650 :type '(choice
2651 (const :tag "Yes, only for TODO entries" t)
2652 (const :tag "Yes, including all entries" all-headlines)
2653 (repeat :tag "Yes, for TODOs in this list"
2654 (string :tag "TODO keyword"))
2655 (list :tag "Yes, for TODOs and DONEs in these lists"
2656 (repeat (string :tag "TODO keyword"))
2657 (repeat (string :tag "DONE keyword")))
2658 (other :tag "No TODO statistics" nil)))
2660 (defcustom org-hierarchical-todo-statistics t
2661 "Non-nil means TODO statistics covers just direct children.
2662 When nil, all entries in the subtree are considered.
2663 This has only an effect if `org-provide-todo-statistics' is set.
2664 To set this to nil for only a single subtree, use a COOKIE_DATA
2665 property and include the word \"recursive\" into the value."
2666 :group 'org-todo
2667 :type 'boolean)
2669 (defcustom org-after-todo-state-change-hook nil
2670 "Hook which is run after the state of a TODO item was changed.
2671 The new state (a string with a TODO keyword, or nil) is available in the
2672 Lisp variable `org-state'."
2673 :group 'org-todo
2674 :type 'hook)
2676 (defvar org-blocker-hook nil
2677 "Hook for functions that are allowed to block a state change.
2679 Functions in this hook should not modify the buffer.
2680 Each function gets as its single argument a property list,
2681 see `org-trigger-hook' for more information about this list.
2683 If any of the functions in this hook returns nil, the state change
2684 is blocked.")
2686 (defvar org-trigger-hook nil
2687 "Hook for functions that are triggered by a state change.
2689 Each function gets as its single argument a property list with at
2690 least the following elements:
2692 (:type type-of-change :position pos-at-entry-start
2693 :from old-state :to new-state)
2695 Depending on the type, more properties may be present.
2697 This mechanism is currently implemented for:
2699 TODO state changes
2700 ------------------
2701 :type todo-state-change
2702 :from previous state (keyword as a string), or nil, or a symbol
2703 `todo' or `done', to indicate the general type of state.
2704 :to new state, like in :from")
2706 (defcustom org-enforce-todo-dependencies nil
2707 "Non-nil means undone TODO entries will block switching the parent to DONE.
2708 Also, if a parent has an :ORDERED: property, switching an entry to DONE will
2709 be blocked if any prior sibling is not yet done.
2710 Finally, if the parent is blocked because of ordered siblings of its own,
2711 the child will also be blocked."
2712 :set (lambda (var val)
2713 (set var val)
2714 (if val
2715 (add-hook 'org-blocker-hook
2716 'org-block-todo-from-children-or-siblings-or-parent)
2717 (remove-hook 'org-blocker-hook
2718 'org-block-todo-from-children-or-siblings-or-parent)))
2719 :group 'org-todo
2720 :type 'boolean)
2722 (defcustom org-enforce-todo-checkbox-dependencies nil
2723 "Non-nil means unchecked boxes will block switching the parent to DONE.
2724 When this is nil, checkboxes have no influence on switching TODO states.
2725 When non-nil, you first need to check off all check boxes before the TODO
2726 entry can be switched to DONE.
2727 This variable needs to be set before org.el is loaded, and you need to
2728 restart Emacs after a change to make the change effective. The only way
2729 to change is while Emacs is running is through the customize interface."
2730 :set (lambda (var val)
2731 (set var val)
2732 (if val
2733 (add-hook 'org-blocker-hook
2734 'org-block-todo-from-checkboxes)
2735 (remove-hook 'org-blocker-hook
2736 'org-block-todo-from-checkboxes)))
2737 :group 'org-todo
2738 :type 'boolean)
2740 (defcustom org-treat-insert-todo-heading-as-state-change nil
2741 "Non-nil means inserting a TODO heading is treated as state change.
2742 So when the command \\[org-insert-todo-heading] is used, state change
2743 logging will apply if appropriate. When nil, the new TODO item will
2744 be inserted directly, and no logging will take place."
2745 :group 'org-todo
2746 :type 'boolean)
2748 (defcustom org-treat-S-cursor-todo-selection-as-state-change t
2749 "Non-nil means switching TODO states with S-cursor counts as state change.
2750 This is the default behavior. However, setting this to nil allows a
2751 convenient way to select a TODO state and bypass any logging associated
2752 with that."
2753 :group 'org-todo
2754 :type 'boolean)
2756 (defcustom org-todo-state-tags-triggers nil
2757 "Tag changes that should be triggered by TODO state changes.
2758 This is a list. Each entry is
2760 (state-change (tag . flag) .......)
2762 State-change can be a string with a state, and empty string to indicate the
2763 state that has no TODO keyword, or it can be one of the symbols `todo'
2764 or `done', meaning any not-done or done state, respectively."
2765 :group 'org-todo
2766 :group 'org-tags
2767 :type '(repeat
2768 (cons (choice :tag "When changing to"
2769 (const :tag "Not-done state" todo)
2770 (const :tag "Done state" done)
2771 (string :tag "State"))
2772 (repeat
2773 (cons :tag "Tag action"
2774 (string :tag "Tag")
2775 (choice (const :tag "Add" t) (const :tag "Remove" nil)))))))
2777 (defcustom org-log-done nil
2778 "Information to record when a task moves to the DONE state.
2780 Possible values are:
2782 nil Don't add anything, just change the keyword
2783 time Add a time stamp to the task
2784 note Prompt for a note and add it with template `org-log-note-headings'
2786 This option can also be set with on a per-file-basis with
2788 #+STARTUP: nologdone
2789 #+STARTUP: logdone
2790 #+STARTUP: lognotedone
2792 You can have local logging settings for a subtree by setting the LOGGING
2793 property to one or more of these keywords."
2794 :group 'org-todo
2795 :group 'org-progress
2796 :type '(choice
2797 (const :tag "No logging" nil)
2798 (const :tag "Record CLOSED timestamp" time)
2799 (const :tag "Record CLOSED timestamp with note." note)))
2801 ;; Normalize old uses of org-log-done.
2802 (cond
2803 ((eq org-log-done t) (setq org-log-done 'time))
2804 ((and (listp org-log-done) (memq 'done org-log-done))
2805 (setq org-log-done 'note)))
2807 (defcustom org-log-reschedule nil
2808 "Information to record when the scheduling date of a tasks is modified.
2810 Possible values are:
2812 nil Don't add anything, just change the date
2813 time Add a time stamp to the task
2814 note Prompt for a note and add it with template `org-log-note-headings'
2816 This option can also be set with on a per-file-basis with
2818 #+STARTUP: nologreschedule
2819 #+STARTUP: logreschedule
2820 #+STARTUP: lognotereschedule"
2821 :group 'org-todo
2822 :group 'org-progress
2823 :type '(choice
2824 (const :tag "No logging" nil)
2825 (const :tag "Record timestamp" time)
2826 (const :tag "Record timestamp with note." note)))
2828 (defcustom org-log-redeadline nil
2829 "Information to record when the deadline date of a tasks is modified.
2831 Possible values are:
2833 nil Don't add anything, just change the date
2834 time Add a time stamp to the task
2835 note Prompt for a note and add it with template `org-log-note-headings'
2837 This option can also be set with on a per-file-basis with
2839 #+STARTUP: nologredeadline
2840 #+STARTUP: logredeadline
2841 #+STARTUP: lognoteredeadline
2843 You can have local logging settings for a subtree by setting the LOGGING
2844 property to one or more of these keywords."
2845 :group 'org-todo
2846 :group 'org-progress
2847 :type '(choice
2848 (const :tag "No logging" nil)
2849 (const :tag "Record timestamp" time)
2850 (const :tag "Record timestamp with note." note)))
2852 (defcustom org-log-note-clock-out nil
2853 "Non-nil means record a note when clocking out of an item.
2854 This can also be configured on a per-file basis by adding one of
2855 the following lines anywhere in the buffer:
2857 #+STARTUP: lognoteclock-out
2858 #+STARTUP: nolognoteclock-out"
2859 :group 'org-todo
2860 :group 'org-progress
2861 :type 'boolean)
2863 (defcustom org-log-done-with-time t
2864 "Non-nil means the CLOSED time stamp will contain date and time.
2865 When nil, only the date will be recorded."
2866 :group 'org-progress
2867 :type 'boolean)
2869 (defcustom org-log-note-headings
2870 '((done . "CLOSING NOTE %t")
2871 (state . "State %-12s from %-12S %t")
2872 (note . "Note taken on %t")
2873 (reschedule . "Rescheduled from %S on %t")
2874 (delschedule . "Not scheduled, was %S on %t")
2875 (redeadline . "New deadline from %S on %t")
2876 (deldeadline . "Removed deadline, was %S on %t")
2877 (refile . "Refiled on %t")
2878 (clock-out . ""))
2879 "Headings for notes added to entries.
2881 The value is an alist, with the car being a symbol indicating the
2882 note context, and the cdr is the heading to be used. The heading
2883 may also be the empty string. The following placeholders can be
2884 used:
2886 %t a time stamp.
2887 %T an active time stamp instead the default inactive one
2888 %d a short-format time stamp.
2889 %D an active short-format time stamp.
2890 %s the new TODO state or time stamp (inactive), in double quotes.
2891 %S the old TODO state or time stamp (inactive), in double quotes.
2892 %u the user name.
2893 %U full user name.
2895 In fact, it is not a good idea to change the `state' entry,
2896 because Agenda Log mode depends on the format of these entries."
2897 :group 'org-todo
2898 :group 'org-progress
2899 :type '(list :greedy t
2900 (cons (const :tag "Heading when closing an item" done) string)
2901 (cons (const :tag
2902 "Heading when changing todo state (todo sequence only)"
2903 state) string)
2904 (cons (const :tag "Heading when just taking a note" note) string)
2905 (cons (const :tag "Heading when rescheduling" reschedule) string)
2906 (cons (const :tag "Heading when an item is no longer scheduled" delschedule) string)
2907 (cons (const :tag "Heading when changing deadline" redeadline) string)
2908 (cons (const :tag "Heading when deleting a deadline" deldeadline) string)
2909 (cons (const :tag "Heading when refiling" refile) string)
2910 (cons (const :tag "Heading when clocking out" clock-out) string)))
2912 (unless (assq 'note org-log-note-headings)
2913 (push '(note . "%t") org-log-note-headings))
2915 (defcustom org-log-into-drawer nil
2916 "Non-nil means insert state change notes and time stamps into a drawer.
2917 When nil, state changes notes will be inserted after the headline and
2918 any scheduling and clock lines, but not inside a drawer.
2920 The value of this variable should be the name of the drawer to use.
2921 LOGBOOK is proposed as the default drawer for this purpose, you can
2922 also set this to a string to define the drawer of your choice.
2924 A value of t is also allowed, representing \"LOGBOOK\".
2926 A value of t or nil can also be set with on a per-file-basis with
2928 #+STARTUP: logdrawer
2929 #+STARTUP: nologdrawer
2931 If this variable is set, `org-log-state-notes-insert-after-drawers'
2932 will be ignored.
2934 You can set the property LOG_INTO_DRAWER to overrule this setting for
2935 a subtree.
2937 Do not check directly this variable in a Lisp program. Call
2938 function `org-log-into-drawer' instead."
2939 :group 'org-todo
2940 :group 'org-progress
2941 :type '(choice
2942 (const :tag "Not into a drawer" nil)
2943 (const :tag "LOGBOOK" t)
2944 (string :tag "Other")))
2946 (org-defvaralias 'org-log-state-notes-into-drawer 'org-log-into-drawer)
2948 (defun org-log-into-drawer ()
2949 "Name of the log drawer, as a string, or nil.
2950 This is the value of `org-log-into-drawer'. However, if the
2951 current entry has or inherits a LOG_INTO_DRAWER property, it will
2952 be used instead of the default value."
2953 (let ((p (org-entry-get nil "LOG_INTO_DRAWER" 'inherit t)))
2954 (cond ((equal p "nil") nil)
2955 ((equal p "t") "LOGBOOK")
2956 ((stringp p) p)
2957 (p "LOGBOOK")
2958 ((stringp org-log-into-drawer) org-log-into-drawer)
2959 (org-log-into-drawer "LOGBOOK"))))
2961 (defcustom org-log-state-notes-insert-after-drawers nil
2962 "Non-nil means insert state change notes after any drawers in entry.
2963 Only the drawers that *immediately* follow the headline and the
2964 deadline/scheduled line are skipped.
2965 When nil, insert notes right after the heading and perhaps the line
2966 with deadline/scheduling if present.
2968 This variable will have no effect if `org-log-into-drawer' is
2969 set."
2970 :group 'org-todo
2971 :group 'org-progress
2972 :type 'boolean)
2974 (defcustom org-log-states-order-reversed t
2975 "Non-nil means the latest state note will be directly after heading.
2976 When nil, the state change notes will be ordered according to time.
2978 This option can also be set with on a per-file-basis with
2980 #+STARTUP: logstatesreversed
2981 #+STARTUP: nologstatesreversed"
2982 :group 'org-todo
2983 :group 'org-progress
2984 :type 'boolean)
2986 (defcustom org-todo-repeat-to-state nil
2987 "The TODO state to which a repeater should return the repeating task.
2988 By default this is the first task in a TODO sequence, or the previous state
2989 in a TODO_TYP set. But you can specify another task here.
2990 alternatively, set the :REPEAT_TO_STATE: property of the entry."
2991 :group 'org-todo
2992 :version "24.1"
2993 :type '(choice (const :tag "Head of sequence" nil)
2994 (string :tag "Specific state")))
2996 (defcustom org-log-repeat 'time
2997 "Non-nil means record moving through the DONE state when triggering repeat.
2998 An auto-repeating task is immediately switched back to TODO when
2999 marked DONE. If you are not logging state changes (by adding \"@\"
3000 or \"!\" to the TODO keyword definition), or set `org-log-done' to
3001 record a closing note, there will be no record of the task moving
3002 through DONE. This variable forces taking a note anyway.
3004 nil Don't force a record
3005 time Record a time stamp
3006 note Prompt for a note and add it with template `org-log-note-headings'
3008 This option can also be set with on a per-file-basis with
3010 #+STARTUP: nologrepeat
3011 #+STARTUP: logrepeat
3012 #+STARTUP: lognoterepeat
3014 You can have local logging settings for a subtree by setting the LOGGING
3015 property to one or more of these keywords."
3016 :group 'org-todo
3017 :group 'org-progress
3018 :type '(choice
3019 (const :tag "Don't force a record" nil)
3020 (const :tag "Force recording the DONE state" time)
3021 (const :tag "Force recording a note with the DONE state" note)))
3024 (defgroup org-priorities nil
3025 "Priorities in Org-mode."
3026 :tag "Org Priorities"
3027 :group 'org-todo)
3029 (defcustom org-enable-priority-commands t
3030 "Non-nil means priority commands are active.
3031 When nil, these commands will be disabled, so that you never accidentally
3032 set a priority."
3033 :group 'org-priorities
3034 :type 'boolean)
3036 (defcustom org-highest-priority ?A
3037 "The highest priority of TODO items. A character like ?A, ?B etc.
3038 Must have a smaller ASCII number than `org-lowest-priority'."
3039 :group 'org-priorities
3040 :type 'character)
3042 (defcustom org-lowest-priority ?C
3043 "The lowest priority of TODO items. A character like ?A, ?B etc.
3044 Must have a larger ASCII number than `org-highest-priority'."
3045 :group 'org-priorities
3046 :type 'character)
3048 (defcustom org-default-priority ?B
3049 "The default priority of TODO items.
3050 This is the priority an item gets if no explicit priority is given.
3051 When starting to cycle on an empty priority the first step in the cycle
3052 depends on `org-priority-start-cycle-with-default'. The resulting first
3053 step priority must not exceed the range from `org-highest-priority' to
3054 `org-lowest-priority' which means that `org-default-priority' has to be
3055 in this range exclusive or inclusive the range boundaries. Else the
3056 first step refuses to set the default and the second will fall back
3057 to (depending on the command used) the highest or lowest priority."
3058 :group 'org-priorities
3059 :type 'character)
3061 (defcustom org-priority-start-cycle-with-default t
3062 "Non-nil means start with default priority when starting to cycle.
3063 When this is nil, the first step in the cycle will be (depending on the
3064 command used) one higher or lower than the default priority.
3065 See also `org-default-priority'."
3066 :group 'org-priorities
3067 :type 'boolean)
3069 (defcustom org-get-priority-function nil
3070 "Function to extract the priority from a string.
3071 The string is normally the headline. If this is nil Org computes the
3072 priority from the priority cookie like [#A] in the headline. It returns
3073 an integer, increasing by 1000 for each priority level.
3074 The user can set a different function here, which should take a string
3075 as an argument and return the numeric priority."
3076 :group 'org-priorities
3077 :version "24.1"
3078 :type '(choice
3079 (const nil)
3080 (function)))
3082 (defgroup org-time nil
3083 "Options concerning time stamps and deadlines in Org-mode."
3084 :tag "Org Time"
3085 :group 'org)
3087 (defcustom org-time-stamp-rounding-minutes '(0 5)
3088 "Number of minutes to round time stamps to.
3089 \\<org-mode-map>\
3090 These are two values, the first applies when first creating a time stamp.
3091 The second applies when changing it with the commands `S-up' and `S-down'.
3092 When changing the time stamp, this means that it will change in steps
3093 of N minutes, as given by the second value.
3095 When a setting is 0 or 1, insert the time unmodified. Useful rounding
3096 numbers should be factors of 60, so for example 5, 10, 15.
3098 When this is larger than 1, you can still force an exact time stamp by using
3099 a double prefix argument to a time stamp command like \
3100 `\\[org-time-stamp]' or `\\[org-time-stamp-inactive],
3101 and by using a prefix arg to `S-up/down' to specify the exact number
3102 of minutes to shift."
3103 :group 'org-time
3104 :get (lambda (var) ; Make sure both elements are there
3105 (if (integerp (default-value var))
3106 (list (default-value var) 5)
3107 (default-value var)))
3108 :type '(list
3109 (integer :tag "when inserting times")
3110 (integer :tag "when modifying times")))
3112 ;; Normalize old customizations of this variable.
3113 (when (integerp org-time-stamp-rounding-minutes)
3114 (setq org-time-stamp-rounding-minutes
3115 (list org-time-stamp-rounding-minutes
3116 org-time-stamp-rounding-minutes)))
3118 (defcustom org-display-custom-times nil
3119 "Non-nil means overlay custom formats over all time stamps.
3120 The formats are defined through the variable `org-time-stamp-custom-formats'.
3121 To turn this on on a per-file basis, insert anywhere in the file:
3122 #+STARTUP: customtime"
3123 :group 'org-time
3124 :set 'set-default
3125 :type 'sexp)
3126 (make-variable-buffer-local 'org-display-custom-times)
3128 (defcustom org-time-stamp-custom-formats
3129 '("<%m/%d/%y %a>" . "<%m/%d/%y %a %H:%M>") ; american
3130 "Custom formats for time stamps. See `format-time-string' for the syntax.
3131 These are overlaid over the default ISO format if the variable
3132 `org-display-custom-times' is set. Time like %H:%M should be at the
3133 end of the second format. The custom formats are also honored by export
3134 commands, if custom time display is turned on at the time of export."
3135 :group 'org-time
3136 :type 'sexp)
3138 (defun org-time-stamp-format (&optional long inactive)
3139 "Get the right format for a time string."
3140 (let ((f (if long (cdr org-time-stamp-formats)
3141 (car org-time-stamp-formats))))
3142 (if inactive
3143 (concat "[" (substring f 1 -1) "]")
3144 f)))
3146 (defcustom org-time-clocksum-format
3147 '(:days "%dd " :hours "%d" :require-hours t :minutes ":%02d" :require-minutes t)
3148 "The format string used when creating CLOCKSUM lines.
3149 This is also used when Org mode generates a time duration.
3151 The value can be a single format string containing two
3152 %-sequences, which will be filled with the number of hours and
3153 minutes in that order.
3155 Alternatively, the value can be a plist associating any of the
3156 keys :years, :months, :weeks, :days, :hours or :minutes with
3157 format strings. The time duration is formatted using only the
3158 time components that are needed and concatenating the results.
3159 If a time unit in absent, it falls back to the next smallest
3160 unit.
3162 The keys :require-years, :require-months, :require-days,
3163 :require-weeks, :require-hours, :require-minutes are also
3164 meaningful. A non-nil value for these keys indicates that the
3165 corresponding time component should always be included, even if
3166 its value is 0.
3169 For example,
3171 (:days \"%dd\" :hours \"%d\" :require-hours t :minutes \":%02d\"
3172 :require-minutes t)
3174 means durations longer than a day will be expressed in days,
3175 hours and minutes, and durations less than a day will always be
3176 expressed in hours and minutes (even for durations less than an
3177 hour).
3179 The value
3181 (:days \"%dd\" :minutes \"%dm\")
3183 means durations longer than a day will be expressed in days and
3184 minutes, and durations less than a day will be expressed entirely
3185 in minutes (even for durations longer than an hour)."
3186 :group 'org-time
3187 :group 'org-clock
3188 :version "24.4"
3189 :package-version '(Org . "8.0")
3190 :type '(choice (string :tag "Format string")
3191 (set :tag "Plist"
3192 (group :inline t (const :tag "Years" :years)
3193 (string :tag "Format string"))
3194 (group :inline t
3195 (const :tag "Always show years" :require-years)
3196 (const t))
3197 (group :inline t (const :tag "Months" :months)
3198 (string :tag "Format string"))
3199 (group :inline t
3200 (const :tag "Always show months" :require-months)
3201 (const t))
3202 (group :inline t (const :tag "Weeks" :weeks)
3203 (string :tag "Format string"))
3204 (group :inline t
3205 (const :tag "Always show weeks" :require-weeks)
3206 (const t))
3207 (group :inline t (const :tag "Days" :days)
3208 (string :tag "Format string"))
3209 (group :inline t
3210 (const :tag "Always show days" :require-days)
3211 (const t))
3212 (group :inline t (const :tag "Hours" :hours)
3213 (string :tag "Format string"))
3214 (group :inline t
3215 (const :tag "Always show hours" :require-hours)
3216 (const t))
3217 (group :inline t (const :tag "Minutes" :minutes)
3218 (string :tag "Format string"))
3219 (group :inline t
3220 (const :tag "Always show minutes" :require-minutes)
3221 (const t)))))
3223 (defcustom org-time-clocksum-use-fractional nil
3224 "When non-nil, \\[org-clock-display] uses fractional times.
3225 See `org-time-clocksum-format' for more on time clock formats."
3226 :group 'org-time
3227 :group 'org-clock
3228 :version "24.3"
3229 :type 'boolean)
3231 (defcustom org-time-clocksum-use-effort-durations nil
3232 "When non-nil, \\[org-clock-display] uses effort durations.
3233 E.g. by default, one day is considered to be a 8 hours effort,
3234 so a task that has been clocked for 16 hours will be displayed
3235 as during 2 days in the clock display or in the clocktable.
3237 See `org-effort-durations' on how to set effort durations
3238 and `org-time-clocksum-format' for more on time clock formats."
3239 :group 'org-time
3240 :group 'org-clock
3241 :version "24.4"
3242 :package-version '(Org . "8.0")
3243 :type 'boolean)
3245 (defcustom org-time-clocksum-fractional-format "%.2f"
3246 "The format string used when creating CLOCKSUM lines,
3247 or when Org mode generates a time duration, if
3248 `org-time-clocksum-use-fractional' is enabled.
3250 The value can be a single format string containing one
3251 %-sequence, which will be filled with the number of hours as
3252 a float.
3254 Alternatively, the value can be a plist associating any of the
3255 keys :years, :months, :weeks, :days, :hours or :minutes with
3256 a format string. The time duration is formatted using the
3257 largest time unit which gives a non-zero integer part. If all
3258 specified formats have zero integer part, the smallest time unit
3259 is used."
3260 :group 'org-time
3261 :type '(choice (string :tag "Format string")
3262 (set (group :inline t (const :tag "Years" :years)
3263 (string :tag "Format string"))
3264 (group :inline t (const :tag "Months" :months)
3265 (string :tag "Format string"))
3266 (group :inline t (const :tag "Weeks" :weeks)
3267 (string :tag "Format string"))
3268 (group :inline t (const :tag "Days" :days)
3269 (string :tag "Format string"))
3270 (group :inline t (const :tag "Hours" :hours)
3271 (string :tag "Format string"))
3272 (group :inline t (const :tag "Minutes" :minutes)
3273 (string :tag "Format string")))))
3275 (defcustom org-deadline-warning-days 14
3276 "Number of days before expiration during which a deadline becomes active.
3277 This variable governs the display in sparse trees and in the agenda.
3278 When 0 or negative, it means use this number (the absolute value of it)
3279 even if a deadline has a different individual lead time specified.
3281 Custom commands can set this variable in the options section."
3282 :group 'org-time
3283 :group 'org-agenda-daily/weekly
3284 :type 'integer)
3286 (defcustom org-scheduled-delay-days 0
3287 "Number of days before a scheduled item becomes active.
3288 This variable governs the display in sparse trees and in the agenda.
3289 The default value (i.e. 0) means: don't delay scheduled item.
3290 When negative, it means use this number (the absolute value of it)
3291 even if a scheduled item has a different individual delay time
3292 specified.
3294 Custom commands can set this variable in the options section."
3295 :group 'org-time
3296 :group 'org-agenda-daily/weekly
3297 :version "24.4"
3298 :package-version '(Org . "8.0")
3299 :type 'integer)
3301 (defcustom org-read-date-prefer-future t
3302 "Non-nil means assume future for incomplete date input from user.
3303 This affects the following situations:
3304 1. The user gives a month but not a year.
3305 For example, if it is April and you enter \"feb 2\", this will be read
3306 as Feb 2, *next* year. \"May 5\", however, will be this year.
3307 2. The user gives a day, but no month.
3308 For example, if today is the 15th, and you enter \"3\", Org-mode will
3309 read this as the third of *next* month. However, if you enter \"17\",
3310 it will be considered as *this* month.
3312 If you set this variable to the symbol `time', then also the following
3313 will work:
3315 3. If the user gives a time.
3316 If the time is before now, it will be interpreted as tomorrow.
3318 Currently none of this works for ISO week specifications.
3320 When this option is nil, the current day, month and year will always be
3321 used as defaults.
3323 See also `org-agenda-jump-prefer-future'."
3324 :group 'org-time
3325 :type '(choice
3326 (const :tag "Never" nil)
3327 (const :tag "Check month and day" t)
3328 (const :tag "Check month, day, and time" time)))
3330 (defcustom org-agenda-jump-prefer-future 'org-read-date-prefer-future
3331 "Should the agenda jump command prefer the future for incomplete dates?
3332 The default is to do the same as configured in `org-read-date-prefer-future'.
3333 But you can also set a deviating value here.
3334 This may t or nil, or the symbol `org-read-date-prefer-future'."
3335 :group 'org-agenda
3336 :group 'org-time
3337 :version "24.1"
3338 :type '(choice
3339 (const :tag "Use org-read-date-prefer-future"
3340 org-read-date-prefer-future)
3341 (const :tag "Never" nil)
3342 (const :tag "Always" t)))
3344 (defcustom org-read-date-force-compatible-dates t
3345 "Should date/time prompt force dates that are guaranteed to work in Emacs?
3347 Depending on the system Emacs is running on, certain dates cannot
3348 be represented with the type used internally to represent time.
3349 Dates between 1970-1-1 and 2038-1-1 can always be represented
3350 correctly. Some systems allow for earlier dates, some for later,
3351 some for both. One way to find out it to insert any date into an
3352 Org buffer, putting the cursor on the year and hitting S-up and
3353 S-down to test the range.
3355 When this variable is set to t, the date/time prompt will not let
3356 you specify dates outside the 1970-2037 range, so it is certain that
3357 these dates will work in whatever version of Emacs you are
3358 running, and also that you can move a file from one Emacs implementation
3359 to another. WHenever Org is forcing the year for you, it will display
3360 a message and beep.
3362 When this variable is nil, Org will check if the date is
3363 representable in the specific Emacs implementation you are using.
3364 If not, it will force a year, usually the current year, and beep
3365 to remind you. Currently this setting is not recommended because
3366 the likelihood that you will open your Org files in an Emacs that
3367 has limited date range is not negligible.
3369 A workaround for this problem is to use diary sexp dates for time
3370 stamps outside of this range."
3371 :group 'org-time
3372 :version "24.1"
3373 :type 'boolean)
3375 (defcustom org-read-date-display-live t
3376 "Non-nil means display current interpretation of date prompt live.
3377 This display will be in an overlay, in the minibuffer."
3378 :group 'org-time
3379 :type 'boolean)
3381 (defcustom org-read-date-popup-calendar t
3382 "Non-nil means pop up a calendar when prompting for a date.
3383 In the calendar, the date can be selected with mouse-1. However, the
3384 minibuffer will also be active, and you can simply enter the date as well.
3385 When nil, only the minibuffer will be available."
3386 :group 'org-time
3387 :type 'boolean)
3388 (org-defvaralias 'org-popup-calendar-for-date-prompt
3389 'org-read-date-popup-calendar)
3391 (make-obsolete-variable
3392 'org-read-date-minibuffer-setup-hook
3393 "Set `org-read-date-minibuffer-local-map' instead." "24.4")
3394 (defcustom org-read-date-minibuffer-setup-hook nil
3395 "Hook to be used to set up keys for the date/time interface.
3396 Add key definitions to `minibuffer-local-map', which will be a
3397 temporary copy.
3399 WARNING: This option is obsolete, you should use
3400 `org-read-date-minibuffer-local-map' to set up keys."
3401 :group 'org-time
3402 :type 'hook)
3404 (defcustom org-extend-today-until 0
3405 "The hour when your day really ends. Must be an integer.
3406 This has influence for the following applications:
3407 - When switching the agenda to \"today\". It it is still earlier than
3408 the time given here, the day recognized as TODAY is actually yesterday.
3409 - When a date is read from the user and it is still before the time given
3410 here, the current date and time will be assumed to be yesterday, 23:59.
3411 Also, timestamps inserted in capture templates follow this rule.
3413 IMPORTANT: This is a feature whose implementation is and likely will
3414 remain incomplete. Really, it is only here because past midnight seems to
3415 be the favorite working time of John Wiegley :-)"
3416 :group 'org-time
3417 :type 'integer)
3419 (defcustom org-use-effective-time nil
3420 "If non-nil, consider `org-extend-today-until' when creating timestamps.
3421 For example, if `org-extend-today-until' is 8, and it's 4am, then the
3422 \"effective time\" of any timestamps between midnight and 8am will be
3423 23:59 of the previous day."
3424 :group 'org-time
3425 :version "24.1"
3426 :type 'boolean)
3428 (defcustom org-use-last-clock-out-time-as-effective-time nil
3429 "When non-nil, use the last clock out time for `org-todo'.
3430 Note that this option has precedence over the combined use of
3431 `org-use-effective-time' and `org-extend-today-until'."
3432 :group 'org-time
3433 :version "24.4"
3434 :package-version '(Org . "8.0")
3435 :type 'boolean)
3437 (defcustom org-edit-timestamp-down-means-later nil
3438 "Non-nil means S-down will increase the time in a time stamp.
3439 When nil, S-up will increase."
3440 :group 'org-time
3441 :type 'boolean)
3443 (defcustom org-calendar-follow-timestamp-change t
3444 "Non-nil means make the calendar window follow timestamp changes.
3445 When a timestamp is modified and the calendar window is visible, it will be
3446 moved to the new date."
3447 :group 'org-time
3448 :type 'boolean)
3450 (defgroup org-tags nil
3451 "Options concerning tags in Org-mode."
3452 :tag "Org Tags"
3453 :group 'org)
3455 (defcustom org-tag-alist nil
3456 "List of tags allowed in Org-mode files.
3457 When this list is nil, Org-mode will base TAG input on what is already in the
3458 buffer.
3459 The value of this variable is an alist, the car of each entry must be a
3460 keyword as a string, the cdr may be a character that is used to select
3461 that tag through the fast-tag-selection interface.
3462 See the manual for details."
3463 :group 'org-tags
3464 :type '(repeat
3465 (choice
3466 (cons (string :tag "Tag name")
3467 (character :tag "Access char"))
3468 (list :tag "Start radio group"
3469 (const :startgroup)
3470 (option (string :tag "Group description")))
3471 (list :tag "Start tag group, non distinct"
3472 (const :startgrouptag)
3473 (option (string :tag "Group description")))
3474 (list :tag "Group tags delimiter"
3475 (const :grouptags))
3476 (list :tag "End radio group"
3477 (const :endgroup)
3478 (option (string :tag "Group description")))
3479 (list :tag "End tag group, non distinct"
3480 (const :endgrouptag)
3481 (option (string :tag "Group description")))
3482 (const :tag "New line" (:newline)))))
3484 (defcustom org-tag-persistent-alist nil
3485 "List of tags that will always appear in all Org-mode files.
3486 This is in addition to any in buffer settings or customizations
3487 of `org-tag-alist'.
3488 When this list is nil, Org-mode will base TAG input on `org-tag-alist'.
3489 The value of this variable is an alist, the car of each entry must be a
3490 keyword as a string, the cdr may be a character that is used to select
3491 that tag through the fast-tag-selection interface.
3492 See the manual for details.
3493 To disable these tags on a per-file basis, insert anywhere in the file:
3494 #+STARTUP: noptag"
3495 :group 'org-tags
3496 :type '(repeat
3497 (choice
3498 (cons (string :tag "Tag name")
3499 (character :tag "Access char"))
3500 (const :tag "Start radio group" (:startgroup))
3501 (const :tag "Group tags delimiter" (:grouptags))
3502 (const :tag "End radio group" (:endgroup))
3503 (const :tag "New line" (:newline)))))
3505 (defcustom org-complete-tags-always-offer-all-agenda-tags nil
3506 "If non-nil, always offer completion for all tags of all agenda files.
3507 Instead of customizing this variable directly, you might want to
3508 set it locally for capture buffers, because there no list of
3509 tags in that file can be created dynamically (there are none).
3511 (add-hook \\='org-capture-mode-hook
3512 (lambda ()
3513 (setq-local org-complete-tags-always-offer-all-agenda-tags t)))"
3514 :group 'org-tags
3515 :version "24.1"
3516 :type 'boolean)
3518 (defvar org-file-tags nil
3519 "List of tags that can be inherited by all entries in the file.
3520 The tags will be inherited if the variable `org-use-tag-inheritance'
3521 says they should be.
3522 This variable is populated from #+FILETAGS lines.")
3524 (defcustom org-use-fast-tag-selection 'auto
3525 "Non-nil means use fast tag selection scheme.
3526 This is a special interface to select and deselect tags with single keys.
3527 When nil, fast selection is never used.
3528 When the symbol `auto', fast selection is used if and only if selection
3529 characters for tags have been configured, either through the variable
3530 `org-tag-alist' or through a #+TAGS line in the buffer.
3531 When t, fast selection is always used and selection keys are assigned
3532 automatically if necessary."
3533 :group 'org-tags
3534 :type '(choice
3535 (const :tag "Always" t)
3536 (const :tag "Never" nil)
3537 (const :tag "When selection characters are configured" auto)))
3539 (defcustom org-fast-tag-selection-single-key nil
3540 "Non-nil means fast tag selection exits after first change.
3541 When nil, you have to press RET to exit it.
3542 During fast tag selection, you can toggle this flag with `C-c'.
3543 This variable can also have the value `expert'. In this case, the window
3544 displaying the tags menu is not even shown, until you press C-c again."
3545 :group 'org-tags
3546 :type '(choice
3547 (const :tag "No" nil)
3548 (const :tag "Yes" t)
3549 (const :tag "Expert" expert)))
3551 (defvar org-fast-tag-selection-include-todo nil
3552 "Non-nil means fast tags selection interface will also offer TODO states.
3553 This is an undocumented feature, you should not rely on it.")
3555 (defcustom org-tags-column (if (featurep 'xemacs) -76 -77)
3556 "The column to which tags should be indented in a headline.
3557 If this number is positive, it specifies the column. If it is negative,
3558 it means that the tags should be flushright to that column. For example,
3559 -80 works well for a normal 80 character screen.
3560 When 0, place tags directly after headline text, with only one space in
3561 between."
3562 :group 'org-tags
3563 :type 'integer)
3565 (defcustom org-auto-align-tags t
3566 "Non-nil keeps tags aligned when modifying headlines.
3567 Some operations (i.e. demoting) change the length of a headline and
3568 therefore shift the tags around. With this option turned on, after
3569 each such operation the tags are again aligned to `org-tags-column'."
3570 :group 'org-tags
3571 :type 'boolean)
3573 (defcustom org-use-tag-inheritance t
3574 "Non-nil means tags in levels apply also for sublevels.
3575 When nil, only the tags directly given in a specific line apply there.
3576 This may also be a list of tags that should be inherited, or a regexp that
3577 matches tags that should be inherited. Additional control is possible
3578 with the variable `org-tags-exclude-from-inheritance' which gives an
3579 explicit list of tags to be excluded from inheritance, even if the value of
3580 `org-use-tag-inheritance' would select it for inheritance.
3582 If this option is t, a match early-on in a tree can lead to a large
3583 number of matches in the subtree when constructing the agenda or creating
3584 a sparse tree. If you only want to see the first match in a tree during
3585 a search, check out the variable `org-tags-match-list-sublevels'."
3586 :group 'org-tags
3587 :type '(choice
3588 (const :tag "Not" nil)
3589 (const :tag "Always" t)
3590 (repeat :tag "Specific tags" (string :tag "Tag"))
3591 (regexp :tag "Tags matched by regexp")))
3593 (defcustom org-tags-exclude-from-inheritance nil
3594 "List of tags that should never be inherited.
3595 This is a way to exclude a few tags from inheritance. For way to do
3596 the opposite, to actively allow inheritance for selected tags,
3597 see the variable `org-use-tag-inheritance'."
3598 :group 'org-tags
3599 :type '(repeat (string :tag "Tag")))
3601 (defun org-tag-inherit-p (tag)
3602 "Check if TAG is one that should be inherited."
3603 (cond
3604 ((member tag org-tags-exclude-from-inheritance) nil)
3605 ((eq org-use-tag-inheritance t) t)
3606 ((not org-use-tag-inheritance) nil)
3607 ((stringp org-use-tag-inheritance)
3608 (string-match org-use-tag-inheritance tag))
3609 ((listp org-use-tag-inheritance)
3610 (member tag org-use-tag-inheritance))
3611 (t (error "Invalid setting of `org-use-tag-inheritance'"))))
3613 (defcustom org-tags-match-list-sublevels t
3614 "Non-nil means list also sublevels of headlines matching a search.
3615 This variable applies to tags/property searches, and also to stuck
3616 projects because this search is based on a tags match as well.
3618 When set to the symbol `indented', sublevels are indented with
3619 leading dots.
3621 Because of tag inheritance (see variable `org-use-tag-inheritance'),
3622 the sublevels of a headline matching a tag search often also match
3623 the same search. Listing all of them can create very long lists.
3624 Setting this variable to nil causes subtrees of a match to be skipped.
3626 This variable is semi-obsolete and probably should always be true. It
3627 is better to limit inheritance to certain tags using the variables
3628 `org-use-tag-inheritance' and `org-tags-exclude-from-inheritance'."
3629 :group 'org-tags
3630 :type '(choice
3631 (const :tag "No, don't list them" nil)
3632 (const :tag "Yes, do list them" t)
3633 (const :tag "List them, indented with leading dots" indented)))
3635 (defcustom org-tags-sort-function nil
3636 "When set, tags are sorted using this function as a comparator."
3637 :group 'org-tags
3638 :type '(choice
3639 (const :tag "No sorting" nil)
3640 (const :tag "Alphabetical" string<)
3641 (const :tag "Reverse alphabetical" string>)
3642 (function :tag "Custom function" nil)))
3644 (defvar org-tags-history nil
3645 "History of minibuffer reads for tags.")
3646 (defvar org-last-tags-completion-table nil
3647 "The last used completion table for tags.")
3648 (defvar org-after-tags-change-hook nil
3649 "Hook that is run after the tags in a line have changed.")
3651 (defgroup org-properties nil
3652 "Options concerning properties in Org-mode."
3653 :tag "Org Properties"
3654 :group 'org)
3656 (defcustom org-property-format "%-10s %s"
3657 "How property key/value pairs should be formatted by `indent-line'.
3658 When `indent-line' hits a property definition, it will format the line
3659 according to this format, mainly to make sure that the values are
3660 lined-up with respect to each other."
3661 :group 'org-properties
3662 :type 'string)
3664 (defcustom org-properties-postprocess-alist nil
3665 "Alist of properties and functions to adjust inserted values.
3666 Elements of this alist must be of the form
3668 ([string] [function])
3670 where [string] must be a property name and [function] must be a
3671 lambda expression: this lambda expression must take one argument,
3672 the value to adjust, and return the new value as a string.
3674 For example, this element will allow the property \"Remaining\"
3675 to be updated wrt the relation between the \"Effort\" property
3676 and the clock summary:
3678 ((\"Remaining\" (lambda(value)
3679 (let ((clocksum (org-clock-sum-current-item))
3680 (effort (org-duration-string-to-minutes
3681 (org-entry-get (point) \"Effort\"))))
3682 (org-minutes-to-clocksum-string (- effort clocksum))))))"
3683 :group 'org-properties
3684 :version "24.1"
3685 :type '(alist :key-type (string :tag "Property")
3686 :value-type (function :tag "Function")))
3688 (defcustom org-use-property-inheritance nil
3689 "Non-nil means properties apply also for sublevels.
3691 This setting is chiefly used during property searches. Turning it on can
3692 cause significant overhead when doing a search, which is why it is not
3693 on by default.
3695 When nil, only the properties directly given in the current entry count.
3696 When t, every property is inherited. The value may also be a list of
3697 properties that should have inheritance, or a regular expression matching
3698 properties that should be inherited.
3700 However, note that some special properties use inheritance under special
3701 circumstances (not in searches). Examples are CATEGORY, ARCHIVE, COLUMNS,
3702 and the properties ending in \"_ALL\" when they are used as descriptor
3703 for valid values of a property.
3705 Note for programmers:
3706 When querying an entry with `org-entry-get', you can control if inheritance
3707 should be used. By default, `org-entry-get' looks only at the local
3708 properties. You can request inheritance by setting the inherit argument
3709 to t (to force inheritance) or to `selective' (to respect the setting
3710 in this variable)."
3711 :group 'org-properties
3712 :type '(choice
3713 (const :tag "Not" nil)
3714 (const :tag "Always" t)
3715 (repeat :tag "Specific properties" (string :tag "Property"))
3716 (regexp :tag "Properties matched by regexp")))
3718 (defun org-property-inherit-p (property)
3719 "Check if PROPERTY is one that should be inherited."
3720 (cond
3721 ((eq org-use-property-inheritance t) t)
3722 ((not org-use-property-inheritance) nil)
3723 ((stringp org-use-property-inheritance)
3724 (string-match org-use-property-inheritance property))
3725 ((listp org-use-property-inheritance)
3726 (member property org-use-property-inheritance))
3727 (t (error "Invalid setting of `org-use-property-inheritance'"))))
3729 (defcustom org-columns-default-format "%25ITEM %TODO %3PRIORITY %TAGS"
3730 "The default column format, if no other format has been defined.
3731 This variable can be set on the per-file basis by inserting a line
3733 #+COLUMNS: %25ITEM ....."
3734 :group 'org-properties
3735 :type 'string)
3737 (defcustom org-columns-ellipses ".."
3738 "The ellipses to be used when a field in column view is truncated.
3739 When this is the empty string, as many characters as possible are shown,
3740 but then there will be no visual indication that the field has been truncated.
3741 When this is a string of length N, the last N characters of a truncated
3742 field are replaced by this string. If the column is narrower than the
3743 ellipses string, only part of the ellipses string will be shown."
3744 :group 'org-properties
3745 :type 'string)
3747 (defcustom org-columns-modify-value-for-display-function nil
3748 "Function that modifies values for display in column view.
3749 For example, it can be used to cut out a certain part from a time stamp.
3750 The function must take 2 arguments:
3752 column-title The title of the column (*not* the property name)
3753 value The value that should be modified.
3755 The function should return the value that should be displayed,
3756 or nil if the normal value should be used."
3757 :group 'org-properties
3758 :type '(choice (const nil) (function)))
3760 (defconst org-global-properties-fixed
3761 '(("VISIBILITY_ALL" . "folded children content all")
3762 ("CLOCK_MODELINE_TOTAL_ALL" . "current today repeat all auto"))
3763 "List of property/value pairs that can be inherited by any entry.
3765 These are fixed values, for the preset properties. The user variable
3766 that can be used to add to this list is `org-global-properties'.
3768 The entries in this list are cons cells where the car is a property
3769 name and cdr is a string with the value. If the value represents
3770 multiple items like an \"_ALL\" property, separate the items by
3771 spaces.")
3773 (defcustom org-global-properties nil
3774 "List of property/value pairs that can be inherited by any entry.
3776 This list will be combined with the constant `org-global-properties-fixed'.
3778 The entries in this list are cons cells where the car is a property
3779 name and cdr is a string with the value.
3781 You can set buffer-local values for the same purpose in the variable
3782 `org-file-properties' this by adding lines like
3785 :group 'org-properties
3786 :type '(repeat
3787 (cons (string :tag "Property")
3788 (string :tag "Value"))))
3790 (defvar-local org-file-properties nil
3791 "List of property/value pairs that can be inherited by any entry.
3792 Valid for the current buffer.
3793 This variable is populated from #+PROPERTY lines.")
3795 (defgroup org-agenda nil
3796 "Options concerning agenda views in Org-mode."
3797 :tag "Org Agenda"
3798 :group 'org)
3800 (defvar-local org-category nil
3801 "Variable used by org files to set a category for agenda display.
3802 Such files should use a file variable to set it, for example
3804 # -*- mode: org; org-category: \"ELisp\"
3806 or contain a special line
3808 #+CATEGORY: ELisp
3810 If the file does not specify a category, then file's base name
3811 is used instead.")
3812 (put 'org-category 'safe-local-variable (lambda (x) (or (symbolp x) (stringp x))))
3814 (defcustom org-agenda-files nil
3815 "The files to be used for agenda display.
3816 Entries may be added to this list with \\[org-agenda-file-to-front] and removed with
3817 \\[org-remove-file]. You can also use customize to edit the list.
3819 If an entry is a directory, all files in that directory that are matched by
3820 `org-agenda-file-regexp' will be part of the file list.
3822 If the value of the variable is not a list but a single file name, then
3823 the list of agenda files is actually stored and maintained in that file, one
3824 agenda file per line. In this file paths can be given relative to
3825 `org-directory'. Tilde expansion and environment variable substitution
3826 are also made."
3827 :group 'org-agenda
3828 :type '(choice
3829 (repeat :tag "List of files and directories" file)
3830 (file :tag "Store list in a file\n" :value "~/.agenda_files")))
3832 (defcustom org-agenda-file-regexp "\\`[^.].*\\.org\\'"
3833 "Regular expression to match files for `org-agenda-files'.
3834 If any element in the list in that variable contains a directory instead
3835 of a normal file, all files in that directory that are matched by this
3836 regular expression will be included."
3837 :group 'org-agenda
3838 :type 'regexp)
3840 (defcustom org-agenda-text-search-extra-files nil
3841 "List of extra files to be searched by text search commands.
3842 These files will be searched in addition to the agenda files by the
3843 commands `org-search-view' (`\\[org-agenda] s') \
3844 and `org-occur-in-agenda-files'.
3845 Note that these files will only be searched for text search commands,
3846 not for the other agenda views like todo lists, tag searches or the weekly
3847 agenda. This variable is intended to list notes and possibly archive files
3848 that should also be searched by these two commands.
3849 In fact, if the first element in the list is the symbol `agenda-archives',
3850 then all archive files of all agenda files will be added to the search
3851 scope."
3852 :group 'org-agenda
3853 :type '(set :greedy t
3854 (const :tag "Agenda Archives" agenda-archives)
3855 (repeat :inline t (file))))
3857 (org-defvaralias 'org-agenda-multi-occur-extra-files
3858 'org-agenda-text-search-extra-files)
3860 (defcustom org-agenda-skip-unavailable-files nil
3861 "Non-nil means to just skip non-reachable files in `org-agenda-files'.
3862 A nil value means to remove them, after a query, from the list."
3863 :group 'org-agenda
3864 :type 'boolean)
3866 (defcustom org-calendar-to-agenda-key [?c]
3867 "The key to be installed in `calendar-mode-map' for switching to the agenda.
3868 The command `org-calendar-goto-agenda' will be bound to this key. The
3869 default is the character `c' because then `c' can be used to switch back and
3870 forth between agenda and calendar."
3871 :group 'org-agenda
3872 :type 'sexp)
3874 (defcustom org-calendar-insert-diary-entry-key [?i]
3875 "The key to be installed in `calendar-mode-map' for adding diary entries.
3876 This option is irrelevant until `org-agenda-diary-file' has been configured
3877 to point to an Org-mode file. When that is the case, the command
3878 `org-agenda-diary-entry' will be bound to the key given here, by default
3879 `i'. In the calendar, `i' normally adds entries to `diary-file'. So
3880 if you want to continue doing this, you need to change this to a different
3881 key."
3882 :group 'org-agenda
3883 :type 'sexp)
3885 (defcustom org-agenda-diary-file 'diary-file
3886 "File to which to add new entries with the `i' key in agenda and calendar.
3887 When this is the symbol `diary-file', the functionality in the Emacs
3888 calendar will be used to add entries to the `diary-file'. But when this
3889 points to a file, `org-agenda-diary-entry' will be used instead."
3890 :group 'org-agenda
3891 :type '(choice
3892 (const :tag "The standard Emacs diary file" diary-file)
3893 (file :tag "Special Org file diary entries")))
3895 (eval-after-load "calendar"
3896 '(progn
3897 (org-defkey calendar-mode-map org-calendar-to-agenda-key
3898 'org-calendar-goto-agenda)
3899 (add-hook 'calendar-mode-hook
3900 (lambda ()
3901 (unless (eq org-agenda-diary-file 'diary-file)
3902 (define-key calendar-mode-map
3903 org-calendar-insert-diary-entry-key
3904 'org-agenda-diary-entry))))))
3906 (defgroup org-latex nil
3907 "Options for embedding LaTeX code into Org-mode."
3908 :tag "Org LaTeX"
3909 :group 'org)
3911 (defcustom org-format-latex-options
3912 '(:foreground default :background default :scale 1.0
3913 :html-foreground "Black" :html-background "Transparent"
3914 :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))
3915 "Options for creating images from LaTeX fragments.
3916 This is a property list with the following properties:
3917 :foreground the foreground color for images embedded in Emacs, e.g. \"Black\".
3918 `default' means use the foreground of the default face.
3919 `auto' means use the foreground from the text face.
3920 :background the background color, or \"Transparent\".
3921 `default' means use the background of the default face.
3922 `auto' means use the background from the text face.
3923 :scale a scaling factor for the size of the images, to get more pixels
3924 :html-foreground, :html-background, :html-scale
3925 the same numbers for HTML export.
3926 :matchers a list indicating which matchers should be used to
3927 find LaTeX fragments. Valid members of this list are:
3928 \"begin\" find environments
3929 \"$1\" find single characters surrounded by $.$
3930 \"$\" find math expressions surrounded by $...$
3931 \"$$\" find math expressions surrounded by $$....$$
3932 \"\\(\" find math expressions surrounded by \\(...\\)
3933 \"\\=\\[\" find math expressions surrounded by \\=\\[...\\]"
3934 :group 'org-latex
3935 :type 'plist)
3937 (defcustom org-format-latex-signal-error t
3938 "Non-nil means signal an error when image creation of LaTeX snippets fails.
3939 When nil, just push out a message."
3940 :group 'org-latex
3941 :version "24.1"
3942 :type 'boolean)
3944 (defcustom org-latex-to-mathml-jar-file nil
3945 "Value of\"%j\" in `org-latex-to-mathml-convert-command'.
3946 Use this to specify additional executable file say a jar file.
3948 When using MathToWeb as the converter, specify the full-path to
3949 your mathtoweb.jar file."
3950 :group 'org-latex
3951 :version "24.1"
3952 :type '(choice
3953 (const :tag "None" nil)
3954 (file :tag "JAR file" :must-match t)))
3956 (defcustom org-latex-to-mathml-convert-command nil
3957 "Command to convert LaTeX fragments to MathML.
3958 Replace format-specifiers in the command as noted below and use
3959 `shell-command' to convert LaTeX to MathML.
3960 %j: Executable file in fully expanded form as specified by
3961 `org-latex-to-mathml-jar-file'.
3962 %I: Input LaTeX file in fully expanded form.
3963 %i: The latex fragment to be converted.
3964 %o: Output MathML file.
3966 This command is used by `org-create-math-formula'.
3968 When using MathToWeb as the converter, set this option to
3969 \"java -jar %j -unicode -force -df %o %I\".
3971 When using LaTeXML set this option to
3972 \"latexmlmath \"%i\" --presentationmathml=%o\"."
3973 :group 'org-latex
3974 :version "24.1"
3975 :type '(choice
3976 (const :tag "None" nil)
3977 (string :tag "\nShell command")))
3979 (defcustom org-latex-create-formula-image-program 'dvipng
3980 "Program to convert LaTeX fragments with.
3982 dvipng Process the LaTeX fragments to dvi file, then convert
3983 dvi files to png files using dvipng.
3984 This will also include processing of non-math environments.
3985 imagemagick Convert the LaTeX fragments to pdf files and use imagemagick
3986 to convert pdf files to png files"
3987 :group 'org-latex
3988 :version "24.1"
3989 :type '(choice
3990 (const :tag "dvipng" dvipng)
3991 (const :tag "imagemagick" imagemagick)))
3993 (defcustom org-latex-preview-ltxpng-directory "ltxpng/"
3994 "Path to store latex preview images.
3995 A relative path here creates many directories relative to the
3996 processed org files paths. An absolute path puts all preview
3997 images at the same place."
3998 :group 'org-latex
3999 :version "24.3"
4000 :type 'string)
4002 (defun org-format-latex-mathml-available-p ()
4003 "Return t if `org-latex-to-mathml-convert-command' is usable."
4004 (save-match-data
4005 (when (and (boundp 'org-latex-to-mathml-convert-command)
4006 org-latex-to-mathml-convert-command)
4007 (let ((executable (car (split-string
4008 org-latex-to-mathml-convert-command))))
4009 (when (executable-find executable)
4010 (if (string-match
4011 "%j" org-latex-to-mathml-convert-command)
4012 (file-readable-p org-latex-to-mathml-jar-file)
4013 t))))))
4015 (defcustom org-format-latex-header "\\documentclass{article}
4016 \\usepackage[usenames]{color}
4017 \[PACKAGES]
4019 \\pagestyle{empty} % do not remove
4020 % The settings below are copied from fullpage.sty
4021 \\setlength{\\textwidth}{\\paperwidth}
4022 \\addtolength{\\textwidth}{-3cm}
4023 \\setlength{\\oddsidemargin}{1.5cm}
4024 \\addtolength{\\oddsidemargin}{-2.54cm}
4025 \\setlength{\\evensidemargin}{\\oddsidemargin}
4026 \\setlength{\\textheight}{\\paperheight}
4027 \\addtolength{\\textheight}{-\\headheight}
4028 \\addtolength{\\textheight}{-\\headsep}
4029 \\addtolength{\\textheight}{-\\footskip}
4030 \\addtolength{\\textheight}{-3cm}
4031 \\setlength{\\topmargin}{1.5cm}
4032 \\addtolength{\\topmargin}{-2.54cm}"
4033 "The document header used for processing LaTeX fragments.
4034 It is imperative that this header make sure that no page number
4035 appears on the page. The package defined in the variables
4036 `org-latex-default-packages-alist' and `org-latex-packages-alist'
4037 will either replace the placeholder \"[PACKAGES]\" in this
4038 header, or they will be appended."
4039 :group 'org-latex
4040 :type 'string)
4042 (defun org-set-packages-alist (var val)
4043 "Set the packages alist and make sure it has 3 elements per entry."
4044 (set var (mapcar (lambda (x)
4045 (if (and (consp x) (= (length x) 2))
4046 (list (car x) (nth 1 x) t)
4047 x))
4048 val)))
4050 (defun org-get-packages-alist (var)
4051 "Get the packages alist and make sure it has 3 elements per entry."
4052 (mapcar (lambda (x)
4053 (if (and (consp x) (= (length x) 2))
4054 (list (car x) (nth 1 x) t)
4055 x))
4056 (default-value var)))
4058 (defcustom org-latex-default-packages-alist
4059 '(("AUTO" "inputenc" t ("pdflatex"))
4060 ("T1" "fontenc" t ("pdflatex"))
4061 ("" "graphicx" t)
4062 ("" "grffile" t)
4063 ("" "longtable" nil)
4064 ("" "wrapfig" nil)
4065 ("" "rotating" nil)
4066 ("normalem" "ulem" t)
4067 ("" "amsmath" t)
4068 ("" "textcomp" t)
4069 ("" "amssymb" t)
4070 ("" "capt-of" nil)
4071 ("" "hyperref" nil))
4072 "Alist of default packages to be inserted in the header.
4074 Change this only if one of the packages here causes an
4075 incompatibility with another package you are using.
4077 The packages in this list are needed by one part or another of
4078 Org mode to function properly:
4080 - inputenc, fontenc: for basic font and character selection
4081 - graphicx: for including images
4082 - grffile: allow periods and spaces in graphics file names
4083 - longtable: For multipage tables
4084 - wrapfig: for figure placement
4085 - rotating: for sideways figures and tables
4086 - ulem: for underline and strike-through
4087 - amsmath: for subscript and superscript and math environments
4088 - textcomp, amssymb: for various symbols used
4089 for interpreting the entities in `org-entities'. You can skip
4090 some of these packages if you don't use any of their symbols.
4091 - capt-of: for captions outside of floats
4092 - hyperref: for cross references
4094 Therefore you should not modify this variable unless you know
4095 what you are doing. The one reason to change it anyway is that
4096 you might be loading some other package that conflicts with one
4097 of the default packages. Each element is either a cell or
4098 a string.
4100 A cell is of the format
4102 (\"options\" \"package\" SNIPPET-FLAG COMPILERS)
4104 If SNIPPET-FLAG is non-nil, the package also needs to be included
4105 when compiling LaTeX snippets into images for inclusion into
4106 non-LaTeX output. COMPILERS is a list of compilers that should
4107 include the package, see `org-latex-compiler'. If the document
4108 compiler is not in the list, and the list is non-nil, the package
4109 will not be inserted in the final document.
4111 A string will be inserted as-is in the header of the document."
4112 :group 'org-latex
4113 :group 'org-export-latex
4114 :set 'org-set-packages-alist
4115 :get 'org-get-packages-alist
4116 :version "25.1"
4117 :package-version '(Org . "8.3")
4118 :type '(repeat
4119 (choice
4120 (list :tag "options/package pair"
4121 (string :tag "options")
4122 (string :tag "package")
4123 (boolean :tag "Snippet"))
4124 (string :tag "A line of LaTeX"))))
4126 (defcustom org-latex-packages-alist nil
4127 "Alist of packages to be inserted in every LaTeX header.
4129 These will be inserted after `org-latex-default-packages-alist'.
4130 Each element is either a cell or a string.
4132 A cell is of the format:
4134 (\"options\" \"package\" SNIPPET-FLAG)
4136 SNIPPET-FLAG, when non-nil, indicates that this package is also
4137 needed when turning LaTeX snippets into images for inclusion into
4138 non-LaTeX output.
4140 A string will be inserted as-is in the header of the document.
4142 Make sure that you only list packages here which:
4144 - you want in every file;
4145 - do not conflict with the setup in `org-format-latex-header';
4146 - do not conflict with the default packages in
4147 `org-latex-default-packages-alist'."
4148 :group 'org-latex
4149 :group 'org-export-latex
4150 :set 'org-set-packages-alist
4151 :get 'org-get-packages-alist
4152 :type '(repeat
4153 (choice
4154 (list :tag "options/package pair"
4155 (string :tag "options")
4156 (string :tag "package")
4157 (boolean :tag "Snippet"))
4158 (string :tag "A line of LaTeX"))))
4160 (defgroup org-appearance nil
4161 "Settings for Org-mode appearance."
4162 :tag "Org Appearance"
4163 :group 'org)
4165 (defcustom org-level-color-stars-only nil
4166 "Non-nil means fontify only the stars in each headline.
4167 When nil, the entire headline is fontified.
4168 Changing it requires restart of `font-lock-mode' to become effective
4169 also in regions already fontified."
4170 :group 'org-appearance
4171 :type 'boolean)
4173 (defcustom org-hide-leading-stars nil
4174 "Non-nil means hide the first N-1 stars in a headline.
4175 This works by using the face `org-hide' for these stars. This
4176 face is white for a light background, and black for a dark
4177 background. You may have to customize the face `org-hide' to
4178 make this work.
4179 Changing it requires restart of `font-lock-mode' to become effective
4180 also in regions already fontified.
4181 You may also set this on a per-file basis by adding one of the following
4182 lines to the buffer:
4184 #+STARTUP: hidestars
4185 #+STARTUP: showstars"
4186 :group 'org-appearance
4187 :type 'boolean)
4189 (defcustom org-hidden-keywords nil
4190 "List of symbols corresponding to keywords to be hidden the org buffer.
4191 For example, a value \\='(title) for this list will make the document's title
4192 appear in the buffer without the initial #+TITLE: keyword."
4193 :group 'org-appearance
4194 :version "24.1"
4195 :type '(set (const :tag "#+AUTHOR" author)
4196 (const :tag "#+DATE" date)
4197 (const :tag "#+EMAIL" email)
4198 (const :tag "#+TITLE" title)))
4200 (defcustom org-custom-properties nil
4201 "List of properties (as strings) with a special meaning.
4202 The default use of these custom properties is to let the user
4203 hide them with `org-toggle-custom-properties-visibility'."
4204 :group 'org-properties
4205 :group 'org-appearance
4206 :version "24.3"
4207 :type '(repeat (string :tag "Property Name")))
4209 (defcustom org-fontify-done-headline nil
4210 "Non-nil means change the face of a headline if it is marked DONE.
4211 Normally, only the TODO/DONE keyword indicates the state of a headline.
4212 When this is non-nil, the headline after the keyword is set to the
4213 `org-headline-done' as an additional indication."
4214 :group 'org-appearance
4215 :type 'boolean)
4217 (defcustom org-fontify-emphasized-text t
4218 "Non-nil means fontify *bold*, /italic/ and _underlined_ text.
4219 Changing this variable requires a restart of Emacs to take effect."
4220 :group 'org-appearance
4221 :type 'boolean)
4223 (defcustom org-fontify-whole-heading-line nil
4224 "Non-nil means fontify the whole line for headings.
4225 This is useful when setting a background color for the
4226 org-level-* faces."
4227 :group 'org-appearance
4228 :type 'boolean)
4230 (defcustom org-highlight-latex-and-related nil
4231 "Non-nil means highlight LaTeX related syntax in the buffer.
4232 When non nil, the value should be a list containing any of the
4233 following symbols:
4234 `latex' Highlight LaTeX snippets and environments.
4235 `script' Highlight subscript and superscript.
4236 `entities' Highlight entities."
4237 :group 'org-appearance
4238 :version "24.4"
4239 :package-version '(Org . "8.0")
4240 :type '(choice
4241 (const :tag "No highlighting" nil)
4242 (set :greedy t :tag "Highlight"
4243 (const :tag "LaTeX snippets and environments" latex)
4244 (const :tag "Subscript and superscript" script)
4245 (const :tag "Entities" entities))))
4247 (defcustom org-hide-emphasis-markers nil
4248 "Non-nil mean font-lock should hide the emphasis marker characters."
4249 :group 'org-appearance
4250 :type 'boolean)
4252 (defcustom org-hide-macro-markers nil
4253 "Non-nil mean font-lock should hide the brackets marking macro calls."
4254 :group 'org-appearance
4255 :type 'boolean)
4257 (defcustom org-pretty-entities nil
4258 "Non-nil means show entities as UTF8 characters.
4259 When nil, the \\name form remains in the buffer."
4260 :group 'org-appearance
4261 :version "24.1"
4262 :type 'boolean)
4264 (defcustom org-pretty-entities-include-sub-superscripts t
4265 "Non-nil means, pretty entity display includes formatting sub/superscripts."
4266 :group 'org-appearance
4267 :version "24.1"
4268 :type 'boolean)
4270 (defvar org-emph-re nil
4271 "Regular expression for matching emphasis.
4272 After a match, the match groups contain these elements:
4273 0 The match of the full regular expression, including the characters
4274 before and after the proper match
4275 1 The character before the proper match, or empty at beginning of line
4276 2 The proper match, including the leading and trailing markers
4277 3 The leading marker like * or /, indicating the type of highlighting
4278 4 The text between the emphasis markers, not including the markers
4279 5 The character after the match, empty at the end of a line")
4280 (defvar org-verbatim-re nil
4281 "Regular expression for matching verbatim text.")
4282 (defvar org-emphasis-regexp-components) ; defined just below
4283 (defvar org-emphasis-alist) ; defined just below
4284 (defun org-set-emph-re (var val)
4285 "Set variable and compute the emphasis regular expression."
4286 (set var val)
4287 (when (and (boundp 'org-emphasis-alist)
4288 (boundp 'org-emphasis-regexp-components)
4289 org-emphasis-alist org-emphasis-regexp-components)
4290 (let* ((e org-emphasis-regexp-components)
4291 (pre (car e))
4292 (post (nth 1 e))
4293 (border (nth 2 e))
4294 (body (nth 3 e))
4295 (nl (nth 4 e))
4296 (body1 (concat body "*?"))
4297 (markers (mapconcat 'car org-emphasis-alist ""))
4298 (vmarkers (mapconcat
4299 (lambda (x) (if (eq (nth 2 x) 'verbatim) (car x) ""))
4300 org-emphasis-alist "")))
4301 ;; make sure special characters appear at the right position in the class
4302 (if (string-match "\\^" markers)
4303 (setq markers (concat (replace-match "" t t markers) "^")))
4304 (if (string-match "-" markers)
4305 (setq markers (concat (replace-match "" t t markers) "-")))
4306 (if (string-match "\\^" vmarkers)
4307 (setq vmarkers (concat (replace-match "" t t vmarkers) "^")))
4308 (if (string-match "-" vmarkers)
4309 (setq vmarkers (concat (replace-match "" t t vmarkers) "-")))
4310 (if (> nl 0)
4311 (setq body1 (concat body1 "\\(?:\n" body "*?\\)\\{0,"
4312 (int-to-string nl) "\\}")))
4313 ;; Make the regexp
4314 (setq org-emph-re
4315 (concat "\\([" pre "]\\|^\\)"
4316 "\\("
4317 "\\([" markers "]\\)"
4318 "\\("
4319 "[^" border "]\\|"
4320 "[^" border "]"
4321 body1
4322 "[^" border "]"
4323 "\\)"
4324 "\\3\\)"
4325 "\\([" post "]\\|$\\)"))
4326 (setq org-verbatim-re
4327 (concat "\\([" pre "]\\|^\\)"
4328 "\\("
4329 "\\([" vmarkers "]\\)"
4330 "\\("
4331 "[^" border "]\\|"
4332 "[^" border "]"
4333 body1
4334 "[^" border "]"
4335 "\\)"
4336 "\\3\\)"
4337 "\\([" post "]\\|$\\)")))))
4339 ;; This used to be a defcustom (Org <8.0) but allowing the users to
4340 ;; set this option proved cumbersome. See this message/thread:
4341 ;; http://article.gmane.org/gmane.emacs.orgmode/68681
4342 (defvar org-emphasis-regexp-components
4343 '(" \t('\"{" "- \t.,:!?;'\")}\\[" " \t\r\n" "." 1)
4344 "Components used to build the regular expression for emphasis.
4345 This is a list with five entries. Terminology: In an emphasis string
4346 like \" *strong word* \", we call the initial space PREMATCH, the final
4347 space POSTMATCH, the stars MARKERS, \"s\" and \"d\" are BORDER characters
4348 and \"trong wor\" is the body. The different components in this variable
4349 specify what is allowed/forbidden in each part:
4351 pre Chars allowed as prematch. Beginning of line will be allowed too.
4352 post Chars allowed as postmatch. End of line will be allowed too.
4353 border The chars *forbidden* as border characters.
4354 body-regexp A regexp like \".\" to match a body character. Don't use
4355 non-shy groups here, and don't allow newline here.
4356 newline The maximum number of newlines allowed in an emphasis exp.
4358 You need to reload Org or to restart Emacs after customizing this.")
4360 (defcustom org-emphasis-alist
4361 `(("*" bold)
4362 ("/" italic)
4363 ("_" underline)
4364 ("=" org-verbatim verbatim)
4365 ("~" org-code verbatim)
4366 ("+" ,(if (featurep 'xemacs) 'org-table '(:strike-through t))))
4367 "Alist of characters and faces to emphasize text.
4368 Text starting and ending with a special character will be emphasized,
4369 for example *bold*, _underlined_ and /italic/. This variable sets the
4370 marker characters and the face to be used by font-lock for highlighting
4371 in Org-mode Emacs buffers.
4373 You need to reload Org or to restart Emacs after customizing this."
4374 :group 'org-appearance
4375 :set 'org-set-emph-re
4376 :version "24.4"
4377 :package-version '(Org . "8.0")
4378 :type '(repeat
4379 (list
4380 (string :tag "Marker character")
4381 (choice
4382 (face :tag "Font-lock-face")
4383 (plist :tag "Face property list"))
4384 (option (const verbatim)))))
4386 (defvar org-protecting-blocks
4387 '("src" "example" "latex" "ascii" "html" "ditaa" "dot" "r" "R")
4388 "Blocks that contain text that is quoted, i.e. not processed as Org syntax.
4389 This is needed for font-lock setup.")
4391 ;;; Miscellaneous options
4393 (defgroup org-completion nil
4394 "Completion in Org-mode."
4395 :tag "Org Completion"
4396 :group 'org)
4398 (defcustom org-completion-use-ido nil
4399 "Non-nil means use ido completion wherever possible.
4400 Note that `ido-mode' must be active for this variable to be relevant.
4401 If you decide to turn this variable on, you might well want to turn off
4402 `org-outline-path-complete-in-steps'.
4403 See also `org-completion-use-iswitchb'."
4404 :group 'org-completion
4405 :type 'boolean)
4407 (defcustom org-completion-use-iswitchb nil
4408 "Non-nil means use iswitchb completion wherever possible.
4409 Note that `iswitchb-mode' must be active for this variable to be relevant.
4410 If you decide to turn this variable on, you might well want to turn off
4411 `org-outline-path-complete-in-steps'.
4412 Note that this variable has only an effect if `org-completion-use-ido' is nil."
4413 :group 'org-completion
4414 :type 'boolean)
4416 (defcustom org-completion-fallback-command 'hippie-expand
4417 "The expansion command called by \\[pcomplete] in normal context.
4418 Normal means, no org-mode-specific context."
4419 :group 'org-completion
4420 :type 'function)
4422 ;;; Functions and variables from their packages
4423 ;; Declared here to avoid compiler warnings
4425 ;; XEmacs only
4426 (defvar outline-mode-menu-heading)
4427 (defvar outline-mode-menu-show)
4428 (defvar outline-mode-menu-hide)
4429 (defvar zmacs-regions) ; XEmacs regions
4431 ;; Emacs only
4432 (defvar mark-active)
4434 ;; Various packages
4435 (declare-function calc-eval "calc" (str &optional separator &rest args))
4436 (declare-function calendar-forward-day "cal-move" (arg))
4437 (declare-function calendar-goto-date "cal-move" (date))
4438 (declare-function calendar-goto-today "cal-move" ())
4439 (declare-function calendar-iso-from-absolute "cal-iso" (date))
4440 (declare-function calendar-iso-to-absolute "cal-iso" (date))
4441 (declare-function cdlatex-compute-tables "ext:cdlatex" ())
4442 (declare-function cdlatex-tab "ext:cdlatex" ())
4443 (declare-function dired-get-filename
4444 "dired"
4445 (&optional localp no-error-if-not-filep))
4446 (declare-function iswitchb-read-buffer
4447 "iswitchb"
4448 (prompt &optional default require-match start matches-set))
4449 (declare-function org-agenda-change-all-lines
4450 "org-agenda"
4451 (newhead hdmarker &optional fixface just-this))
4452 (declare-function org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item
4453 "org-agenda"
4454 (&optional end))
4455 (declare-function org-agenda-copy-local-variable "org-agenda" (var))
4456 (declare-function org-agenda-format-item
4457 "org-agenda"
4458 (extra txt &optional level category tags dotime noprefix
4459 remove-re habitp))
4460 (declare-function org-agenda-maybe-redo "org-agenda" ())
4461 (declare-function org-agenda-new-marker "org-agenda" (&optional pos))
4462 (declare-function org-agenda-save-markers-for-cut-and-paste
4463 "org-agenda"
4464 (beg end))
4465 (declare-function org-agenda-set-restriction-lock "org-agenda" (&optional type))
4466 (declare-function org-agenda-skip "org-agenda" ())
4467 (declare-function org-attach-reveal "org-attach" (&optional if-exists))
4468 (declare-function org-gnus-follow-link "org-gnus" (&optional group article))
4469 (declare-function org-indent-mode "org-indent" (&optional arg))
4470 (declare-function org-inlinetask-goto-beginning "org-inlinetask" ())
4471 (declare-function org-inlinetask-goto-end "org-inlinetask" ())
4472 (declare-function org-inlinetask-in-task-p "org-inlinetask" ())
4473 (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
4474 (declare-function orgtbl-send-table "org-table" (&optional maybe))
4475 (declare-function parse-time-string "parse-time" (string))
4476 (declare-function speedbar-line-directory "speedbar" (&optional depth))
4477 (declare-function table--at-cell-p
4478 "table"
4479 (position &optional object at-column))
4481 (defvar align-mode-rules-list)
4482 (defvar calc-embedded-close-formula)
4483 (defvar calc-embedded-open-formula)
4484 (defvar calc-embedded-open-mode)
4485 (defvar font-lock-unfontify-region-function)
4486 (defvar iswitchb-temp-buflist)
4487 (defvar org-agenda-tags-todo-honor-ignore-options)
4488 (defvar remember-data-file)
4489 (defvar texmathp-why)
4491 ;;;###autoload
4492 (defun turn-on-orgtbl ()
4493 "Unconditionally turn on `orgtbl-mode'."
4494 (require 'org-table)
4495 (orgtbl-mode 1))
4497 (defun org-at-table-p (&optional table-type)
4498 "Non-nil if the cursor is inside an Org table.
4499 If TABLE-TYPE is non-nil, also check for table.el-type tables.
4500 If `org-enable-table-editor' is nil, return nil unconditionally."
4501 (and
4502 org-enable-table-editor
4503 (save-excursion
4504 (beginning-of-line)
4505 (org-looking-at-p (if table-type "[ \t]*[|+]" "[ \t]*|")))
4506 (or (not (derived-mode-p 'org-mode))
4507 (let ((e (org-element-lineage (org-element-at-point) '(table) t)))
4508 (and e (or table-type (eq (org-element-property :type e) 'org)))))))
4509 (define-obsolete-function-alias 'org-table-p 'org-at-table-p "Org 9.0")
4511 (defun org-at-table.el-p ()
4512 "Non-nil when point is at a table.el table."
4513 (and (save-excursion (beginning-of-line) (looking-at "[ \t]*[|+]"))
4514 (let ((element (org-element-at-point)))
4515 (and (eq (org-element-type element) 'table)
4516 (eq (org-element-property :type element) 'table.el)))))
4518 (defun org-table-recognize-table.el ()
4519 "If there is a table.el table nearby, recognize it and move into it."
4520 (when (and org-table-tab-recognizes-table.el (org-at-table.el-p))
4521 (beginning-of-line)
4522 (unless (or (looking-at org-table-dataline-regexp)
4523 (not (looking-at org-table1-hline-regexp)))
4524 (forward-line)
4525 (when (looking-at org-table-any-border-regexp)
4526 (forward-line -2)))
4527 (if (re-search-forward "|" (org-table-end t) t)
4528 (progn
4529 (require 'table)
4530 (if (table--at-cell-p (point)) t
4531 (message "recognizing table.el table...")
4532 (table-recognize-table)
4533 (message "recognizing table.el table...done")))
4534 (error "This should not happen"))))
4535 ;;; This function is not used by org core since commit 6d1e3082, Feb 2010
4536 (make-obsolete 'org-table-recognize-table.el
4537 "please notify the org mailing list if you use this function."
4538 "Org 9.0")
4540 (defun org-at-table-hline-p ()
4541 "Non-nil when point is inside a hline in a table.
4542 Assume point is already in a table. If `org-enable-table-editor'
4543 is nil, return nil unconditionally."
4544 (and org-enable-table-editor
4545 (save-excursion
4546 (beginning-of-line)
4547 (looking-at org-table-hline-regexp))))
4549 (defun org-table-map-tables (function &optional quietly)
4550 "Apply FUNCTION to the start of all tables in the buffer."
4551 (save-excursion
4552 (save-restriction
4553 (widen)
4554 (goto-char (point-min))
4555 (while (re-search-forward org-table-any-line-regexp nil t)
4556 (unless quietly
4557 (message "Mapping tables: %d%%"
4558 (floor (* 100.0 (point)) (buffer-size))))
4559 (beginning-of-line 1)
4560 (when (and (looking-at org-table-line-regexp)
4561 ;; Exclude tables in src/example/verbatim/clocktable blocks
4562 (not (org-in-block-p '("src" "example" "verbatim" "clocktable"))))
4563 (save-excursion (funcall function))
4564 (or (looking-at org-table-line-regexp)
4565 (forward-char 1)))
4566 (re-search-forward org-table-any-border-regexp nil 1))))
4567 (unless quietly (message "Mapping tables: done")))
4569 (declare-function org-clock-save-markers-for-cut-and-paste "org-clock" (beg end))
4570 (declare-function org-clock-update-mode-line "org-clock" ())
4571 (declare-function org-resolve-clocks "org-clock"
4572 (&optional also-non-dangling-p prompt last-valid))
4574 (defun org-at-TBLFM-p (&optional pos)
4575 "Non-nil when point (or POS) is in #+TBLFM line."
4576 (save-excursion
4577 (goto-char (or pos (point)))
4578 (beginning-of-line)
4579 (and (let ((case-fold-search t)) (looking-at org-TBLFM-regexp))
4580 (eq (org-element-type (org-element-at-point)) 'table))))
4582 (defvar org-clock-start-time)
4583 (defvar org-clock-marker (make-marker)
4584 "Marker recording the last clock-in.")
4585 (defvar org-clock-hd-marker (make-marker)
4586 "Marker recording the last clock-in, but the headline position.")
4587 (defvar org-clock-heading ""
4588 "The heading of the current clock entry.")
4589 (defun org-clock-is-active ()
4590 "Return the buffer where the clock is currently running.
4591 Return nil if no clock is running."
4592 (marker-buffer org-clock-marker))
4594 (defun org-check-running-clock ()
4595 "Check if the current buffer contains the running clock.
4596 If yes, offer to stop it and to save the buffer with the changes."
4597 (when (and (equal (marker-buffer org-clock-marker) (current-buffer))
4598 (y-or-n-p (format "Clock-out in buffer %s before killing it? "
4599 (buffer-name))))
4600 (org-clock-out)
4601 (when (y-or-n-p "Save changed buffer?")
4602 (save-buffer))))
4604 (defun org-clocktable-try-shift (dir n)
4605 "Check if this line starts a clock table, if yes, shift the time block."
4606 (when (org-match-line "^[ \t]*#\\+BEGIN:[ \t]+clocktable\\>")
4607 (org-clocktable-shift dir n)))
4609 ;;;###autoload
4610 (defun org-clock-persistence-insinuate ()
4611 "Set up hooks for clock persistence."
4612 (require 'org-clock)
4613 (add-hook 'org-mode-hook 'org-clock-load)
4614 (add-hook 'kill-emacs-hook 'org-clock-save))
4616 (defgroup org-archive nil
4617 "Options concerning archiving in Org-mode."
4618 :tag "Org Archive"
4619 :group 'org-structure)
4621 (defcustom org-archive-location "%s_archive::"
4622 "The location where subtrees should be archived.
4624 The value of this variable is a string, consisting of two parts,
4625 separated by a double-colon. The first part is a filename and
4626 the second part is a headline.
4628 When the filename is omitted, archiving happens in the same file.
4629 %s in the filename will be replaced by the current file
4630 name (without the directory part). Archiving to a different file
4631 is useful to keep archived entries from contributing to the
4632 Org-mode Agenda.
4634 The archived entries will be filed as subtrees of the specified
4635 headline. When the headline is omitted, the subtrees are simply
4636 filed away at the end of the file, as top-level entries. Also in
4637 the heading you can use %s to represent the file name, this can be
4638 useful when using the same archive for a number of different files.
4640 Here are a few examples:
4641 \"%s_archive::\"
4642 If the current file is Projects.org, archive in file
4643 Projects.org_archive, as top-level trees. This is the default.
4645 \"::* Archived Tasks\"
4646 Archive in the current file, under the top-level headline
4647 \"* Archived Tasks\".
4649 \"~/org/archive.org::\"
4650 Archive in file ~/org/archive.org (absolute path), as top-level trees.
4652 \"~/org/archive.org::* From %s\"
4653 Archive in file ~/org/archive.org (absolute path), under headlines