Clean up string handling.
[org-mode.git] / lisp / org.el
1 ;;; org.el --- Outline-based notes management and organizer -*- lexical-binding: t; -*-
3 ;; Carstens outline-mode for keeping track of everything.
4 ;; Copyright (C) 2004-2016 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:
11 ;; This file is part of GNU Emacs.
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation, either version 3 of the License, or
16 ;; (at your option) any later version.
18 ;; GNU Emacs is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs. If not, see <>.
26 ;;; Commentary:
28 ;; Org is a mode for keeping notes, maintaining ToDo lists, and doing
29 ;; project planning with a fast and effective plain-text system.
31 ;; Org mode develops organizational tasks around NOTES files that
32 ;; contain information about projects as plain text. Org mode is
33 ;; implemented on top of outline-mode, which makes it possible to keep
34 ;; the content of large files well structured. Visibility cycling and
35 ;; structure editing help to work with the tree. Tables are easily
36 ;; created with a built-in table editor. Org mode supports ToDo
37 ;; items, deadlines, time stamps, and scheduling. It dynamically
38 ;; compiles entries into an agenda that utilizes and smoothly
39 ;; integrates much of the Emacs calendar and diary. Plain text
40 ;; URL-like links connect to websites, emails, Usenet messages, BBDB
41 ;; entries, and any files related to the projects. For printing and
42 ;; sharing of notes, an Org file can be exported as a structured ASCII
43 ;; file, as HTML, or (todo and agenda items only) as an iCalendar
44 ;; file. It can also serve as a publishing tool for a set of linked
45 ;; webpages.
47 ;; Installation and Activation
48 ;; ---------------------------
49 ;; See the corresponding sections in the manual at
51 ;;
53 ;; Documentation
54 ;; -------------
55 ;; The documentation of Org mode can be found in the TeXInfo file. The
56 ;; distribution also contains a PDF version of it. At the homepage of
57 ;; Org mode, you can read the same text online as HTML. There is also an
58 ;; excellent reference card made by Philip Rooke. This card can be found
59 ;; in the doc/ directory.
61 ;; A list of recent changes can be found at
62 ;;
64 ;;; Code:
66 (defvar org-inhibit-highlight-removal nil) ; dynamically scoped param
67 (defvar-local org-table-formula-constants-local nil
68 "Local version of `org-table-formula-constants'.")
70 ;;;; Require other packages
72 (require 'cl-lib)
74 (eval-when-compile (require 'gnus-sum))
76 (require 'calendar)
77 (require 'find-func)
78 (require 'format-spec)
80 (or (equal this-command 'eval-buffer)
81 (condition-case nil
82 (load (concat (file-name-directory load-file-name)
83 "org-loaddefs.el")
84 nil t t t)
85 (error
86 (message "WARNING: No org-loaddefs.el file could be found from where org.el is loaded.")
87 (sit-for 3)
88 (message "You need to run \"make\" or \"make autoloads\" from Org lisp directory")
89 (sit-for 3))))
91 (require 'org-macs)
92 (require 'org-compat)
94 ;; `org-outline-regexp' ought to be a defconst but is let-bound in
95 ;; some places -- e.g. see the macro `org-with-limited-levels'.
97 ;; In Org buffers, the value of `outline-regexp' is that of
98 ;; `org-outline-regexp'. The only function still directly relying on
99 ;; `outline-regexp' is `org-overview' so that `org-cycle' can do its
100 ;; job when `orgstruct-mode' is active.
101 (defvar org-outline-regexp "\\*+ "
102 "Regexp to match Org headlines.")
104 (defvar org-outline-regexp-bol "^\\*+ "
105 "Regexp to match Org headlines.
106 This is similar to `org-outline-regexp' but additionally makes
107 sure that we are at the beginning of the line.")
109 (defvar org-heading-regexp "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
110 "Matches a headline, putting stars and text into groups.
111 Stars are put in group 1 and the trimmed body in group 2.")
113 (declare-function calendar-check-holidays "holidays" (date))
114 (declare-function cdlatex-environment "ext:cdlatex" (environment item))
115 (declare-function isearch-no-upper-case-p "isearch" (string regexp-flag))
116 (declare-function org-add-archive-files "org-archive" (files))
117 (declare-function org-agenda-entry-get-agenda-timestamp "org-agenda" (pom))
118 (declare-function org-agenda-list "org-agenda"
119 (&optional arg start-day span with-hour))
120 (declare-function org-agenda-redo "org-agenda" (&optional all))
121 (declare-function org-babel-do-in-edit-buffer "ob-core" (&rest body) t)
122 (declare-function org-babel-tangle-file "ob-tangle" (file &optional target-file lang))
123 (declare-function org-beamer-mode "ox-beamer" (&optional prefix) t)
124 (declare-function org-clock-get-last-clock-out-time "org-clock" ())
125 (declare-function org-clock-out "org-clock" (&optional switch-to-state fail-quietly at-time))
126 (declare-function org-clock-remove-overlays "org-clock" (&optional beg end noremove))
127 (declare-function org-clock-sum "org-clock" (&optional tstart tend headline-filter propname))
128 (declare-function org-clock-sum-current-item "org-clock" (&optional tstart))
129 (declare-function org-clock-timestamps-down "org-clock" (&optional n))
130 (declare-function org-clock-timestamps-up "org-clock" (&optional n))
131 (declare-function org-clock-update-time-maybe "org-clock" ())
132 (declare-function org-clocktable-shift "org-clock" (dir n))
133 (declare-function org-element-at-point "org-element" ())
134 (declare-function org-element-cache-refresh "org-element" (pos))
135 (declare-function org-element-cache-reset "org-element" (&optional all))
136 (declare-function org-element-contents "org-element" (element))
137 (declare-function org-element-context "org-element" (&optional element))
138 (declare-function org-element-copy "org-element" (datum))
139 (declare-function org-element-interpret-data "org-element" (data))
140 (declare-function org-element-lineage "org-element" (blob &optional types with-self))
141 (declare-function org-element-nested-p "org-element" (elem-a elem-b))
142 (declare-function org-element-parse-buffer "org-element" (&optional granularity visible-only))
143 (declare-function org-element-property "org-element" (property element))
144 (declare-function org-element-put-property "org-element" (element property value))
145 (declare-function org-element-swap-A-B "org-element" (elem-a elem-b))
146 (declare-function org-element-type "org-element" (element))
147 (declare-function org-element-update-syntax "org-element" ())
148 (declare-function org-id-find-id-file "org-id" (id))
149 (declare-function org-id-get-create "org-id" (&optional force))
150 (declare-function org-inlinetask-at-task-p "org-inlinetask" ())
151 (declare-function org-inlinetask-outline-regexp "org-inlinetask" ())
152 (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ())
153 (declare-function org-plot/gnuplot "org-plot" (&optional params))
154 (declare-function org-table-align "org-table" ())
155 (declare-function org-table-begin "org-table" (&optional table-type))
156 (declare-function org-table-beginning-of-field "org-table" (&optional n))
157 (declare-function org-table-blank-field "org-table" ())
158 (declare-function org-table-calc-current-TBLFM "org-table" (&optional arg))
159 (declare-function org-table-edit-field "org-table" (arg))
160 (declare-function org-table-end "org-table" (&optional table-type))
161 (declare-function org-table-end-of-field "org-table" (&optional n))
162 (declare-function org-table-insert-row "org-table" (&optional arg))
163 (declare-function org-table-justify-field-maybe "org-table" (&optional new))
164 (declare-function org-table-maybe-eval-formula "org-table" ())
165 (declare-function org-table-maybe-recalculate-line "org-table" ())
166 (declare-function org-table-next-row "org-table" ())
167 (declare-function org-table-paste-rectangle "org-table" ())
168 (declare-function org-table-wrap-region "org-table" (arg))
169 (declare-function org-tags-view "org-agenda" (&optional todo-only match))
170 (declare-function orgtbl-ascii-plot "org-table" (&optional ask))
171 (declare-function orgtbl-mode "org-table" (&optional arg))
173 (defsubst org-uniquify (list)
174 "Non-destructively remove duplicate elements from LIST."
175 (let ((res (copy-sequence list))) (delete-dups res)))
177 (defsubst org-get-at-bol (property)
178 "Get text property PROPERTY at the beginning of line."
179 (get-text-property (point-at-bol) property))
181 (defsubst org-trim (s &optional keep-lead)
182 "Remove whitespace at the beginning and the end of string S.
183 When optional argument KEEP-LEAD is non-nil, removing blank lines
184 at the beginning of the string does not affect leading indentation."
185 (replace-regexp-in-string
186 (if keep-lead "\\`\\([ \t]*\n\\)+" "\\`[ \t\n\r]+") ""
187 (replace-regexp-in-string "[ \t\n\r]+\\'" "" s)))
189 ;; load languages based on value of `org-babel-load-languages'
190 (defvar org-babel-load-languages)
192 ;;;###autoload
193 (defun org-babel-do-load-languages (sym value)
194 "Load the languages defined in `org-babel-load-languages'."
195 (set-default sym value)
196 (dolist (pair org-babel-load-languages)
197 (let ((active (cdr pair)) (lang (symbol-name (car pair))))
198 (if active
199 (require (intern (concat "ob-" lang)))
200 (funcall 'fmakunbound
201 (intern (concat "org-babel-execute:" lang)))
202 (funcall 'fmakunbound
203 (intern (concat "org-babel-expand-body:" lang)))))))
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 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 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 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 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
323 (ignore-errors (org-find-library-dir "org-loaddefs"))))
324 (unless (and (fboundp 'org-release) (fboundp 'org-git-version))
325 (org-load-noerror-mustsuffix (concat org-dir "org-version")))
326 (let* ((load-suffixes save-load-suffixes)
327 (release (org-release))
328 (git-version (org-git-version))
329 (version (format "Org-mode version %s (%s @ %s)"
330 release
331 git-version
332 (if org-install-dir
333 (if (string= org-dir org-install-dir)
334 org-install-dir
335 (concat "mixed installation! "
336 org-install-dir
337 " and "
338 org-dir))
339 "org-loaddefs.el can not be found!")))
340 (version1 (if full version release)))
341 (when here (insert version1))
342 (when message (message "%s" version1))
343 version1)))
345 (defconst org-version (org-version))
348 ;;; Syntax Constants
350 ;;;; Block
352 (defconst org-block-regexp
353 "^[ \t]*#\\+begin_?\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_?\\1[ \t]*$"
354 "Regular expression for hiding blocks.")
356 (defconst org-dblock-start-re
357 "^[ \t]*#\\+\\(?:BEGIN\\|begin\\):[ \t]+\\(\\S-+\\)\\([ \t]+\\(.*\\)\\)?"
358 "Matches the start line of a dynamic block, with parameters.")
360 (defconst org-dblock-end-re "^[ \t]*#\\+\\(?:END\\|end\\)\\([: \t\r\n]\\|$\\)"
361 "Matches the end of a dynamic block.")
363 ;;;; Clock and Planning
365 (defconst org-clock-string "CLOCK:"
366 "String used as prefix for timestamps clocking work hours on an item.")
368 (defvar org-closed-string "CLOSED:"
369 "String used as the prefix for timestamps logging closing a TODO entry.")
371 (defvar org-deadline-string "DEADLINE:"
372 "String to mark deadline entries.
373 A deadline is this string, followed by a time stamp. Should be a word,
374 terminated by a colon. You can insert a schedule keyword and
375 a timestamp with \\[org-deadline].")
377 (defvar org-scheduled-string "SCHEDULED:"
378 "String to mark scheduled TODO entries.
379 A schedule is this string, followed by a time stamp. Should be a word,
380 terminated by a colon. You can insert a schedule keyword and
381 a timestamp with \\[org-schedule].")
383 (defconst org-ds-keyword-length
384 (+ 2
385 (apply #'max
386 (mapcar #'length
387 (list org-deadline-string org-scheduled-string
388 org-clock-string org-closed-string))))
389 "Maximum length of the DEADLINE and SCHEDULED keywords.")
391 (defconst org-planning-line-re
392 (concat "^[ \t]*"
393 (regexp-opt
394 (list org-closed-string org-deadline-string org-scheduled-string)
396 "Matches a line with planning info.
397 Matched keyword is in group 1.")
399 (defconst org-clock-line-re
400 (concat "^[ \t]*" org-clock-string)
401 "Matches a line with clock info.")
403 (defconst org-deadline-regexp (concat "\\<" org-deadline-string)
404 "Matches the DEADLINE keyword.")
406 (defconst org-deadline-time-regexp
407 (concat "\\<" org-deadline-string " *<\\([^>]+\\)>")
408 "Matches the DEADLINE keyword together with a time stamp.")
410 (defconst org-deadline-time-hour-regexp
411 (concat "\\<" org-deadline-string
412 " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9-+:hdwmy \t.]*\\)>")
413 "Matches the DEADLINE keyword together with a time-and-hour stamp.")
415 (defconst org-deadline-line-regexp
416 (concat "\\<\\(" org-deadline-string "\\).*")
417 "Matches the DEADLINE keyword and the rest of the line.")
419 (defconst org-scheduled-regexp (concat "\\<" org-scheduled-string)
420 "Matches the SCHEDULED keyword.")
422 (defconst org-scheduled-time-regexp
423 (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>")
424 "Matches the SCHEDULED keyword together with a time stamp.")
426 (defconst org-scheduled-time-hour-regexp
427 (concat "\\<" org-scheduled-string
428 " *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9-+:hdwmy \t.]*\\)>")
429 "Matches the SCHEDULED keyword together with a time-and-hour stamp.")
431 (defconst org-closed-time-regexp
432 (concat "\\<" org-closed-string " *\\[\\([^]]+\\)\\]")
433 "Matches the CLOSED keyword together with a time stamp.")
435 (defconst org-keyword-time-regexp
436 (concat "\\<"
437 (regexp-opt
438 (list org-scheduled-string org-deadline-string org-closed-string
439 org-clock-string)
441 " *[[<]\\([^]>]+\\)[]>]")
442 "Matches any of the 4 keywords, together with the time stamp.")
444 (defconst org-keyword-time-not-clock-regexp
445 (concat
446 "\\<"
447 (regexp-opt
448 (list org-scheduled-string org-deadline-string org-closed-string) t)
449 " *[[<]\\([^]>]+\\)[]>]")
450 "Matches any of the 3 keywords, together with the time stamp.")
452 (defconst org-maybe-keyword-time-regexp
453 (concat "\\(\\<"
454 (regexp-opt
455 (list org-scheduled-string org-deadline-string org-closed-string
456 org-clock-string)
458 "\\)?"
459 " *\\([[<][0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^]\r\n>]*?[]>]"
460 "\\|"
461 "<%%([^\r\n>]*>\\)")
462 "Matches a timestamp, possibly preceded by a keyword.")
464 (defconst org-all-time-keywords
465 (mapcar (lambda (w) (substring w 0 -1))
466 (list org-scheduled-string org-deadline-string
467 org-clock-string org-closed-string))
468 "List of time keywords.")
470 ;;;; Drawer
472 (defconst org-drawer-regexp "^[ \t]*:\\(\\(?:\\w\\|[-_]\\)+\\):[ \t]*$"
473 "Matches first or last line of a hidden block.
474 Group 1 contains drawer's name or \"END\".")
476 (defconst org-property-start-re "^[ \t]*:PROPERTIES:[ \t]*$"
477 "Regular expression matching the first line of a property drawer.")
479 (defconst org-property-end-re "^[ \t]*:END:[ \t]*$"
480 "Regular expression matching the last line of a property drawer.")
482 (defconst org-clock-drawer-start-re "^[ \t]*:CLOCK:[ \t]*$"
483 "Regular expression matching the first line of a clock drawer.")
485 (defconst org-clock-drawer-end-re "^[ \t]*:END:[ \t]*$"
486 "Regular expression matching the last line of a clock drawer.")
488 (defconst org-property-drawer-re
489 (concat "^[ \t]*:PROPERTIES:[ \t]*\n"
490 "\\(?:[ \t]*:\\S-+:\\(?: .*\\)?[ \t]*\n\\)*?"
491 "[ \t]*:END:[ \t]*$")
492 "Matches an entire property drawer.")
494 (defconst org-clock-drawer-re
495 (concat "\\(" org-clock-drawer-start-re "\\)[^\000]*?\\("
496 org-clock-drawer-end-re "\\)\n?")
497 "Matches an entire clock drawer.")
499 ;;;; Headline
501 (defconst org-heading-keyword-regexp-format
502 "^\\(\\*+\\)\\(?: +%s\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
503 "Printf format for a regexp matching a headline with some keyword.
504 This regexp will match the headline of any node which has the
505 exact keyword that is put into the format. The keyword isn't in
506 any group by default, but the stars and the body are.")
508 (defconst org-heading-keyword-maybe-regexp-format
509 "^\\(\\*+\\)\\(?: +%s\\)?\\(?: +\\(.*?\\)\\)?[ \t]*$"
510 "Printf format for a regexp matching a headline, possibly with some keyword.
511 This regexp can match any headline with the specified keyword, or
512 without a keyword. The keyword isn't in any group by default,
513 but the stars and the body are.")
515 (defconst org-archive-tag "ARCHIVE"
516 "The tag that marks a subtree as archived.
517 An archived subtree does not open during visibility cycling, and does
518 not contribute to the agenda listings.")
520 (defconst org-comment-string "COMMENT"
521 "Entries starting with this keyword will never be exported.
522 An entry can be toggled between COMMENT and normal with
523 \\[org-toggle-comment].")
526 ;;;; LaTeX Environments and Fragments
528 (defconst org-latex-regexps
529 '(("begin" "^[ \t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t)
530 ;; ("$" "\\([ (]\\|^\\)\\(\\(\\([$]\\)\\([^ \r\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \r\n,.$]\\)\\4\\)\\)\\([ .,?;:'\")]\\|$\\)" 2 nil)
531 ;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p
532 ("$1" "\\([^$]\\|^\\)\\(\\$[^ \r\n,;.$]\\$\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|$\\)" 2 nil)
533 ("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|$\\)" 2 nil)
534 ("\\(" "\\\\([^\000]*?\\\\)" 0 nil)
535 ("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 nil)
536 ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil))
537 "Regular expressions for matching embedded LaTeX.")
539 ;;;; Node Property
541 (defconst org-effort-property "Effort"
542 "The property that is being used to keep track of effort estimates.
543 Effort estimates given in this property need to have the format H:MM.")
545 ;;;; Table
547 (defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)"
548 "Detect an org-type or table-type table.")
550 (defconst org-table-line-regexp "^[ \t]*|"
551 "Detect an org-type table line.")
553 (defconst org-table-dataline-regexp "^[ \t]*|[^-]"
554 "Detect an org-type table line.")
556 (defconst org-table-hline-regexp "^[ \t]*|-"
557 "Detect an org-type table hline.")
559 (defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]"
560 "Detect a table-type table hline.")
562 (defconst org-table-any-border-regexp "^[ \t]*[^|+ \t]"
563 "Detect the first line outside a table when searching from within it.
564 This works for both table types.")
566 (defconst org-TBLFM-regexp "^[ \t]*#\\+TBLFM: "
567 "Detect a #+TBLFM line.")
569 ;;;; Timestamp
571 (defconst org-ts-regexp "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^\r\n>]*?\\)>"
572 "Regular expression for fast time stamp matching.")
574 (defconst org-ts-regexp-inactive
575 "\\[\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^\r\n>]*?\\)\\]"
576 "Regular expression for fast inactive time stamp matching.")
578 (defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} ?[^]\r\n>]*?\\)[]>]"
579 "Regular expression for fast time stamp matching.")
581 (defconst org-ts-regexp0
582 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\( +[^]+0-9>\r\n -]+\\)?\\( +\\([0-9]\\{1,2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
583 "Regular expression matching time strings for analysis.
584 This one does not require the space after the date, so it can be used
585 on a string that terminates immediately after the date.")
587 (defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) *\\([^]+0-9>\r\n -]*\\)\\( \\([0-9]\\{1,2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
588 "Regular expression matching time strings for analysis.")
590 (defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,16\\}>")
591 "Regular expression matching time stamps, with groups.")
593 (defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[^]>\n]\\{0,16\\}[]>]")
594 "Regular expression matching time stamps (also [..]), with groups.")
596 (defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp)
597 "Regular expression matching a time stamp range.")
599 (defconst org-tr-regexp-both
600 (concat org-ts-regexp-both "--?-?" org-ts-regexp-both)
601 "Regular expression matching a time stamp range.")
603 (defconst org-tsr-regexp (concat org-ts-regexp "\\(--?-?"
604 org-ts-regexp "\\)?")
605 "Regular expression matching a time stamp or time stamp range.")
607 (defconst org-tsr-regexp-both
608 (concat org-ts-regexp-both "\\(--?-?"
609 org-ts-regexp-both "\\)?")
610 "Regular expression matching a time stamp or time stamp range.
611 The time stamps may be either active or inactive.")
613 (defconst org-repeat-re
614 "<[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^>\n]*?\\([.+]?\\+[0-9]+[hdwmy]\\(/[0-9]+[hdwmy]\\)?\\)"
615 "Regular expression for specifying repeated events.
616 After a match, group 1 contains the repeat expression.")
618 (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
619 "Formats for `format-time-string' which are used for time stamps.")
622 ;;; The custom variables
624 (defgroup org nil
625 "Outline-based notes management and organizer."
626 :tag "Org"
627 :group 'outlines
628 :group 'calendar)
630 (defcustom org-mode-hook nil
631 "Mode hook for Org-mode, run after the mode was turned on."
632 :group 'org
633 :type 'hook)
635 (defcustom org-load-hook nil
636 "Hook that is run after org.el has been loaded."
637 :group 'org
638 :type 'hook)
640 (defcustom org-log-buffer-setup-hook nil
641 "Hook that is run after an Org log buffer is created."
642 :group 'org
643 :version "24.1"
644 :type 'hook)
646 (defvar org-modules) ; defined below
647 (defvar org-modules-loaded nil
648 "Have the modules been loaded already?")
650 (defun org-load-modules-maybe (&optional force)
651 "Load all extensions listed in `org-modules'."
652 (when (or force (not org-modules-loaded))
653 (dolist (ext org-modules)
654 (condition-case nil (require ext)
655 (error (message "Problems while trying to load feature `%s'" ext))))
656 (setq org-modules-loaded t)))
658 (defun org-set-modules (var value)
659 "Set VAR to VALUE and call `org-load-modules-maybe' with the force flag."
660 (set var value)
661 (when (featurep 'org)
662 (org-load-modules-maybe 'force)
663 (org-element-cache-reset 'all)))
665 (defcustom org-modules '(org-w3m org-bbdb org-bibtex org-docview org-gnus org-info org-irc org-mhe org-rmail)
666 "Modules that should always be loaded together with org.el.
668 If a description starts with <C>, the file is not part of Emacs
669 and loading it will require that you have downloaded and properly
670 installed the Org mode distribution.
672 You can also use this system to load external packages (i.e. neither Org
673 core modules, nor modules from the CONTRIB directory). Just add symbols
674 to the end of the list. If the package is called org-xyz.el, then you need
675 to add the symbol `xyz', and the package must have a call to:
677 (provide \\='org-xyz)
679 For export specific modules, see also `org-export-backends'."
680 :group 'org
681 :set 'org-set-modules
682 :version "24.4"
683 :package-version '(Org . "8.0")
684 :type
685 '(set :greedy t
686 (const :tag " bbdb: Links to BBDB entries" org-bbdb)
687 (const :tag " bibtex: Links to BibTeX entries" org-bibtex)
688 (const :tag " crypt: Encryption of subtrees" org-crypt)
689 (const :tag " ctags: Access to Emacs tags with links" org-ctags)
690 (const :tag " docview: Links to doc-view buffers" org-docview)
691 (const :tag " eww: Store link to url of eww" org-eww)
692 (const :tag " gnus: Links to GNUS folders/messages" org-gnus)
693 (const :tag " habit: Track your consistency with habits" org-habit)
694 (const :tag " id: Global IDs for identifying entries" org-id)
695 (const :tag " info: Links to Info nodes" org-info)
696 (const :tag " inlinetask: Tasks independent of outline hierarchy" org-inlinetask)
697 (const :tag " irc: Links to IRC/ERC chat sessions" org-irc)
698 (const :tag " mhe: Links to MHE folders/messages" org-mhe)
699 (const :tag " mouse: Additional mouse support" org-mouse)
700 (const :tag " protocol: Intercept calls from emacsclient" org-protocol)
701 (const :tag " rmail: Links to RMAIL folders/messages" org-rmail)
702 (const :tag " w3m: Special cut/paste from w3m to Org-mode." org-w3m)
704 (const :tag "C annotate-file: Annotate a file with org syntax" org-annotate-file)
705 (const :tag "C bookmark: Org links to bookmarks" org-bookmark)
706 (const :tag "C bullets: Add overlays to headlines stars" org-bullets)
707 (const :tag "C checklist: Extra functions for checklists in repeated tasks" org-checklist)
708 (const :tag "C choose: Use TODO keywords to mark decisions states" org-choose)
709 (const :tag "C collector: Collect properties into tables" org-collector)
710 (const :tag "C depend: TODO dependencies for Org-mode\n\t\t\t(PARTIALLY OBSOLETE, see built-in dependency support))" org-depend)
711 (const :tag "C drill: Flashcards and spaced repetition for Org-mode" org-drill)
712 (const :tag "C elisp-symbol: Org links to emacs-lisp symbols" org-elisp-symbol)
713 (const :tag "C eshell Support for links to working directories in eshell" org-eshell)
714 (const :tag "C eval-light: Evaluate inbuffer-code on demand" org-eval-light)
715 (const :tag "C eval: Include command output as text" org-eval)
716 (const :tag "C expiry: Expiry mechanism for Org entries" org-expiry)
717 (const :tag "C favtable: Lookup table of favorite references and links" org-favtable)
718 (const :tag "C git-link: Provide org links to specific file version" org-git-link)
719 (const :tag "C interactive-query: Interactive modification of tags query\n\t\t\t(PARTIALLY OBSOLETE, see secondary filtering)" org-interactive-query)
720 (const :tag "C invoice: Help manage client invoices in Org-mode" org-invoice)
721 (const :tag "C learn: SuperMemo's incremental learning algorithm" org-learn)
722 (const :tag "C mac-iCal Imports events from to the Emacs diary" org-mac-iCal)
723 (const :tag "C mac-link: Grab links and url from various mac Applications" org-mac-link)
724 (const :tag "C mairix: Hook mairix search into Org for different MUAs" org-mairix)
725 (const :tag "C man: Support for links to manpages in Org-mode" org-man)
726 (const :tag "C mew: Links to Mew folders/messages" org-mew)
727 (const :tag "C mtags: Support for muse-like tags" org-mtags)
728 (const :tag "C notmuch: Provide org links to notmuch searches or messages" org-notmuch)
729 (const :tag "C panel: Simple routines for us with bad memory" org-panel)
730 (const :tag "C registry: A registry for Org links" org-registry)
731 (const :tag "C screen: Visit screen sessions through Org links" org-screen)
732 (const :tag "C secretary: Team management with org-mode" org-secretary)
733 (const :tag "C sqlinsert: Convert Org tables to SQL insertions" orgtbl-sqlinsert)
734 (const :tag "C toc: Table of contents for Org buffer" org-toc)
735 (const :tag "C track: Keep up with Org mode development" org-track)
736 (const :tag "C velocity Something like Notational Velocity for Org" org-velocity)
737 (const :tag "C vm: Links to VM folders/messages" org-vm)
738 (const :tag "C wikinodes: CamelCase wiki-like links" org-wikinodes)
739 (const :tag "C wl: Links to Wanderlust folders/messages" org-wl)
740 (repeat :tag "External packages" :inline t (symbol :tag "Package"))))
742 (defvar org-export-registered-backends) ; From ox.el.
743 (declare-function org-export-derived-backend-p "ox" (backend &rest backends))
744 (declare-function org-export-backend-name "ox" (backend) t)
745 (defcustom org-export-backends '(ascii html icalendar latex odt)
746 "List of export back-ends that should be always available.
748 If a description starts with <C>, the file is not part of Emacs
749 and loading it will require that you have downloaded and properly
750 installed the Org mode distribution.
752 Unlike to `org-modules', libraries in this list will not be
753 loaded along with Org, but only once the export framework is
754 needed.
756 This variable needs to be set before org.el is loaded. If you
757 need to make a change while Emacs is running, use the customize
758 interface or run the following code, where VAL stands for the new
759 value of the variable, after updating it:
761 (progn
762 (setq org-export-registered-backends
763 (cl-remove-if-not
764 (lambda (backend)
765 (let ((name (org-export-backend-name backend)))
766 (or (memq name val)
767 (catch \\='parentp
768 (dolist (b val)
769 (and (org-export-derived-backend-p b name)
770 (throw \\='parentp t)))))))
771 org-export-registered-backends))
772 (let ((new-list (mapcar #\\='org-export-backend-name
773 org-export-registered-backends)))
774 (dolist (backend val)
775 (cond
776 ((not (load (format \"ox-%s\" backend) t t))
777 (message \"Problems while trying to load export back-end \\=`%s\\='\"
778 backend))
779 ((not (memq backend new-list)) (push backend new-list))))
780 (set-default \\='org-export-backends new-list)))
782 Adding a back-end to this list will also pull the back-end it
783 depends on, if any."
784 :group 'org
785 :group 'org-export
786 :version "25.1"
787 :package-version '(Org . "9.0")
788 :initialize 'custom-initialize-set
789 :set (lambda (var val)
790 (if (not (featurep 'ox)) (set-default var val)
791 ;; Any back-end not required anymore (not present in VAL and not
792 ;; a parent of any back-end in the new value) is removed from the
793 ;; list of registered back-ends.
794 (setq org-export-registered-backends
795 (cl-remove-if-not
796 (lambda (backend)
797 (let ((name (org-export-backend-name backend)))
798 (or (memq name val)
799 (catch 'parentp
800 (dolist (b val)
801 (and (org-export-derived-backend-p b name)
802 (throw 'parentp t)))))))
803 org-export-registered-backends))
804 ;; Now build NEW-LIST of both new back-ends and required
805 ;; parents.
806 (let ((new-list (mapcar #'org-export-backend-name
807 org-export-registered-backends)))
808 (dolist (backend val)
809 (cond
810 ((not (load (format "ox-%s" backend) t t))
811 (message "Problems while trying to load export back-end `%s'"
812 backend))
813 ((not (memq backend new-list)) (push backend new-list))))
814 ;; Set VAR to that list with fixed dependencies.
815 (set-default var new-list))))
816 :type '(set :greedy t
817 (const :tag " ascii Export buffer to ASCII format" ascii)
818 (const :tag " beamer Export buffer to Beamer presentation" beamer)
819 (const :tag " html Export buffer to HTML format" html)
820 (const :tag " icalendar Export buffer to iCalendar format" icalendar)
821 (const :tag " latex Export buffer to LaTeX format" latex)
822 (const :tag " man Export buffer to MAN format" man)
823 (const :tag " md Export buffer to Markdown format" md)
824 (const :tag " odt Export buffer to ODT format" odt)
825 (const :tag " org Export buffer to Org format" org)
826 (const :tag " texinfo Export buffer to Texinfo format" texinfo)
827 (const :tag "C confluence Export buffer to Confluence Wiki format" confluence)
828 (const :tag "C deck Export buffer to deck.js presentations" deck)
829 (const :tag "C freemind Export buffer to Freemind mindmap format" freemind)
830 (const :tag "C groff Export buffer to Groff format" groff)
831 (const :tag "C koma-letter Export buffer to KOMA Scrlttrl2 format" koma-letter)
832 (const :tag "C RSS 2.0 Export buffer to RSS 2.0 format" rss)
833 (const :tag "C s5 Export buffer to s5 presentations" s5)
834 (const :tag "C taskjuggler Export buffer to TaskJuggler format" taskjuggler)))
836 (eval-after-load 'ox
837 '(dolist (backend org-export-backends)
838 (condition-case nil (require (intern (format "ox-%s" backend)))
839 (error (message "Problems while trying to load export back-end `%s'"
840 backend)))))
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."
881 :group 'org
882 :type '(choice
883 (const :tag "Never" nil)
884 (const :tag "When outside special context" t)
885 (const :tag "Everywhere except timestamps" always)))
887 (defcustom org-loop-over-headlines-in-active-region nil
888 "Shall some commands act upon headlines in the active region?
890 When set to t, some commands will be performed in all headlines
891 within the active region.
893 When set to `start-level', some commands will be performed in all
894 headlines within the active region, provided that these headlines
895 are of the same level than the first one.
897 When set to a string, those commands will be performed on the
898 matching headlines within the active region. Such string must be
899 a tags/property/todo match as it is used in the agenda tags view.
901 The list of commands is: `org-schedule', `org-deadline',
902 `org-todo', `org-archive-subtree', `org-archive-set-tag' and
903 `org-archive-to-archive-sibling'. The archiving commands skip
904 already archived entries."
905 :type '(choice (const :tag "Don't loop" nil)
906 (const :tag "All headlines in active region" t)
907 (const :tag "In active region, headlines at the same level than the first one" start-level)
908 (string :tag "Tags/Property/Todo matcher"))
909 :version "24.1"
910 :group 'org-todo
911 :group 'org-archive)
913 (defgroup org-startup nil
914 "Options concerning startup of Org-mode."
915 :tag "Org Startup"
916 :group 'org)
918 (defcustom org-startup-folded t
919 "Non-nil means entering Org mode will switch to OVERVIEW.
920 This can also be configured on a per-file basis by adding one of
921 the following lines anywhere in the buffer:
923 #+STARTUP: fold (or `overview', this is equivalent)
924 #+STARTUP: nofold (or `showall', this is equivalent)
925 #+STARTUP: content
926 #+STARTUP: showeverything
928 By default, this option is ignored when Org opens agenda files
929 for the first time. If you want the agenda to honor the startup
930 option, set `org-agenda-inhibit-startup' to nil."
931 :group 'org-startup
932 :type '(choice
933 (const :tag "nofold: show all" nil)
934 (const :tag "fold: overview" t)
935 (const :tag "content: all headlines" content)
936 (const :tag "show everything, even drawers" showeverything)))
938 (defcustom org-startup-truncated t
939 "Non-nil means entering Org mode will set `truncate-lines'.
940 This is useful since some lines containing links can be very long and
941 uninteresting. Also tables look terrible when wrapped.
943 The variable `org-startup-truncated' allows to configure
944 truncation for Org mode different to the other modes that use the
945 variable `truncate-lines' and as a shortcut instead of putting
946 the variable `truncate-lines' into the `org-mode-hook'. If one
947 wants to configure truncation for Org mode not statically but
948 dynamically e. g. in a hook like `ediff-prepare-buffer-hook' then
949 the variable `truncate-lines' has to be used because in such a
950 case it is too late to set the variable `org-startup-truncated'."
951 :group 'org-startup
952 :type 'boolean)
954 (defcustom org-startup-indented nil
955 "Non-nil means turn on `org-indent-mode' on startup.
956 This can also be configured on a per-file basis by adding one of
957 the following lines anywhere in the buffer:
959 #+STARTUP: indent
960 #+STARTUP: noindent"
961 :group 'org-structure
962 :type '(choice
963 (const :tag "Not" nil)
964 (const :tag "Globally (slow on startup in large files)" t)))
966 (defcustom org-use-sub-superscripts t
967 "Non-nil means interpret \"_\" and \"^\" for display.
969 If you want to control how Org exports those characters, see
970 `org-export-with-sub-superscripts'. `org-use-sub-superscripts'
971 used to be an alias for `org-export-with-sub-superscripts' in
972 Org <8.0, it is not anymore.
974 When this option is turned on, you can use TeX-like syntax for
975 sub- and superscripts within the buffer. Several characters after
976 \"_\" or \"^\" will be considered as a single item - so grouping
977 with {} is normally not needed. For example, the following things
978 will be parsed as single sub- or superscripts:
980 10^24 or 10^tau several digits will be considered 1 item.
981 10^-12 or 10^-tau a leading sign with digits or a word
982 x^2-y^3 will be read as x^2 - y^3, because items are
983 terminated by almost any nonword/nondigit char.
984 x_{i^2} or x^(2-i) braces or parenthesis do grouping.
986 Still, ambiguity is possible. So when in doubt, use {} to enclose
987 the sub/superscript. If you set this variable to the symbol `{}',
988 the braces are *required* in order to trigger interpretations as
989 sub/superscript. This can be helpful in documents that need \"_\"
990 frequently in plain text."
991 :group 'org-startup
992 :version "24.4"
993 :package-version '(Org . "8.0")
994 :type '(choice
995 (const :tag "Always interpret" t)
996 (const :tag "Only with braces" {})
997 (const :tag "Never interpret" nil)))
999 (defcustom org-startup-with-beamer-mode nil
1000 "Non-nil means turn on `org-beamer-mode' on startup.
1001 This can also be configured on a per-file basis by adding one of
1002 the following lines anywhere in the buffer:
1004 #+STARTUP: beamer"
1005 :group 'org-startup
1006 :version "24.1"
1007 :type 'boolean)
1009 (defcustom org-startup-align-all-tables nil
1010 "Non-nil means align all tables when visiting a file.
1011 This is useful when the column width in tables is forced with <N> cookies
1012 in table fields. Such tables will look correct only after the first re-align.
1013 This can also be configured on a per-file basis by adding one of
1014 the following lines anywhere in the buffer:
1015 #+STARTUP: align
1016 #+STARTUP: noalign"
1017 :group 'org-startup
1018 :type 'boolean)
1020 (defcustom org-startup-with-inline-images nil
1021 "Non-nil means show inline images when loading a new Org file.
1022 This can also be configured on a per-file basis by adding one of
1023 the following lines anywhere in the buffer:
1024 #+STARTUP: inlineimages
1025 #+STARTUP: noinlineimages"
1026 :group 'org-startup
1027 :version "24.1"
1028 :type 'boolean)
1030 (defcustom org-startup-with-latex-preview nil
1031 "Non-nil means preview LaTeX fragments when loading a new Org file.
1033 This can also be configured on a per-file basis by adding one of
1034 the following lines anywhere in the buffer:
1035 #+STARTUP: latexpreview
1036 #+STARTUP: nolatexpreview"
1037 :group 'org-startup
1038 :version "24.4"
1039 :package-version '(Org . "8.0")
1040 :type 'boolean)
1042 (defcustom org-insert-mode-line-in-empty-file nil
1043 "Non-nil means insert the first line setting Org mode in empty files.
1044 When the function `org-mode' is called interactively in an empty file, this
1045 normally means that the file name does not automatically trigger Org mode.
1046 To ensure that the file will always be in Org mode in the future, a
1047 line enforcing Org mode will be inserted into the buffer, if this option
1048 has been set."
1049 :group 'org-startup
1050 :type 'boolean)
1052 (defcustom org-replace-disputed-keys nil
1053 "Non-nil means use alternative key bindings for some keys.
1054 Org mode uses S-<cursor> keys for changing timestamps and priorities.
1055 These keys are also used by other packages like shift-selection-mode'
1056 \(built into Emacs 23), `CUA-mode' or `windmove.el'.
1057 If you want to use Org mode together with one of these other modes,
1058 or more generally if you would like to move some Org mode commands to
1059 other keys, set this variable and configure the keys with the variable
1060 `org-disputed-keys'.
1062 This option is only relevant at load-time of Org-mode, and must be set
1063 *before* org.el is loaded. Changing it requires a restart of Emacs to
1064 become effective."
1065 :group 'org-startup
1066 :type 'boolean)
1068 (defcustom org-use-extra-keys nil
1069 "Non-nil means use extra key sequence definitions for certain commands.
1070 This happens automatically if `window-system' is nil. This
1071 variable lets you do the same manually. You must set it before
1072 loading Org."
1073 :group 'org-startup
1074 :type 'boolean)
1076 (defvaralias 'org-CUA-compatible 'org-replace-disputed-keys)
1078 (defcustom org-disputed-keys
1079 '(([(shift up)] . [(meta p)])
1080 ([(shift down)] . [(meta n)])
1081 ([(shift left)] . [(meta -)])
1082 ([(shift right)] . [(meta +)])
1083 ([(control shift right)] . [(meta shift +)])
1084 ([(control shift left)] . [(meta shift -)]))
1085 "Keys for which Org mode and other modes compete.
1086 This is an alist, cars are the default keys, second element specifies
1087 the alternative to use when `org-replace-disputed-keys' is t.
1089 Keys can be specified in any syntax supported by `define-key'.
1090 The value of this option takes effect only at Org-mode's startup,
1091 therefore you'll have to restart Emacs to apply it after changing."
1092 :group 'org-startup
1093 :type 'alist)
1095 (defun org-key (key)
1096 "Select key according to `org-replace-disputed-keys' and `org-disputed-keys'.
1097 Or return the original if not disputed."
1098 (when org-replace-disputed-keys
1099 (let* ((nkey (key-description key))
1100 (x (cl-find-if (lambda (x) (equal (key-description (car x)) nkey))
1101 org-disputed-keys)))
1102 (setq key (if x (cdr x) key))))
1103 key)
1105 (defun org-defkey (keymap key def)
1106 "Define a key, possibly translated, as returned by `org-key'."
1107 (define-key keymap (org-key key) def))
1109 (defcustom org-ellipsis nil
1110 "The ellipsis to use in the Org mode outline.
1111 When nil, just use the standard three dots.
1112 When a string, use that string instead.
1113 When a face, use the standard 3 dots, but with the specified face.
1114 The change affects only Org mode (which will then use its own display table).
1115 Changing this requires executing \\[org-mode] in a buffer to become
1116 effective."
1117 :group 'org-startup
1118 :type '(choice (const :tag "Default" nil)
1119 (face :tag "Face" :value org-warning)
1120 (string :tag "String" :value "...#")))
1122 (defvar org-display-table nil
1123 "The display table for org-mode, in case `org-ellipsis' is non-nil.")
1125 (defgroup org-keywords nil
1126 "Keywords in Org-mode."
1127 :tag "Org Keywords"
1128 :group 'org)
1130 (defcustom org-closed-keep-when-no-todo nil
1131 "Remove CLOSED: time-stamp when switching back to a non-todo state?"
1132 :group 'org-todo
1133 :group 'org-keywords
1134 :version "24.4"
1135 :package-version '(Org . "8.0")
1136 :type 'boolean)
1138 (defgroup org-structure nil
1139 "Options concerning the general structure of Org files."
1140 :tag "Org Structure"
1141 :group 'org)
1143 (defgroup org-reveal-location nil
1144 "Options about how to make context of a location visible."
1145 :tag "Org Reveal Location"
1146 :group 'org-structure)
1148 (defcustom org-show-context-detail '((agenda . local)
1149 (bookmark-jump . lineage)
1150 (isearch . lineage)
1151 (default . ancestors))
1152 "Alist between context and visibility span when revealing a location.
1154 \\<org-mode-map>Some actions may move point into invisible
1155 locations. As a consequence, Org always expose a neighborhood
1156 around point. How much is shown depends on the initial action,
1157 or context. Valid contexts are
1159 agenda when exposing an entry from the agenda
1160 org-goto when using the command `org-goto' (\\[org-goto])
1161 occur-tree when using the command `org-occur' (\\[org-sparse-tree] /)
1162 tags-tree when constructing a sparse tree based on tags matches
1163 link-search when exposing search matches associated with a link
1164 mark-goto when exposing the jump goal of a mark
1165 bookmark-jump when exposing a bookmark location
1166 isearch when exiting from an incremental search
1167 default default for all contexts not set explicitly
1169 Allowed visibility spans are
1171 minimal show current headline; if point is not on headline,
1172 also show entry
1174 local show current headline, entry and next headline
1176 ancestors show current headline and its direct ancestors; if
1177 point is not on headline, also show entry
1179 lineage show current headline, its direct ancestors and all
1180 their children; if point is not on headline, also show
1181 entry and first child
1183 tree show current headline, its direct ancestors and all
1184 their children; if point is not on headline, also show
1185 entry and all children
1187 canonical show current headline, its direct ancestors along with
1188 their entries and children; if point is not located on
1189 the headline, also show current entry and all children
1191 As special cases, a nil or t value means show all contexts in
1192 `minimal' or `canonical' view, respectively.
1194 Some views can make displayed information very compact, but also
1195 make it harder to edit the location of the match. In such
1196 a case, use the command `org-reveal' (\\[org-reveal]) to show
1197 more context."
1198 :group 'org-reveal-location
1199 :version "25.2"
1200 :package-version '(Org . "9.0")
1201 :type '(choice
1202 (const :tag "Canonical" t)
1203 (const :tag "Minimal" nil)
1204 (repeat :greedy t :tag "Individual contexts"
1205 (cons
1206 (choice :tag "Context"
1207 (const agenda)
1208 (const org-goto)
1209 (const occur-tree)
1210 (const tags-tree)
1211 (const link-search)
1212 (const mark-goto)
1213 (const bookmark-jump)
1214 (const isearch)
1215 (const default))
1216 (choice :tag "Detail level"
1217 (const minimal)
1218 (const local)
1219 (const ancestors)
1220 (const lineage)
1221 (const tree)
1222 (const canonical))))))
1224 (defcustom org-indirect-buffer-display 'other-window
1225 "How should indirect tree buffers be displayed?
1226 This applies to indirect buffers created with the commands
1227 \\[org-tree-to-indirect-buffer] and \\[org-agenda-tree-to-indirect-buffer].
1228 Valid values are:
1229 current-window Display in the current window
1230 other-window Just display in another window.
1231 dedicated-frame Create one new frame, and re-use it each time.
1232 new-frame Make a new frame each time. Note that in this case
1233 previously-made indirect buffers are kept, and you need to
1234 kill these buffers yourself."
1235 :group 'org-structure
1236 :group 'org-agenda-windows
1237 :type '(choice
1238 (const :tag "In current window" current-window)
1239 (const :tag "In current frame, other window" other-window)
1240 (const :tag "Each time a new frame" new-frame)
1241 (const :tag "One dedicated frame" dedicated-frame)))
1243 (defcustom org-use-speed-commands nil
1244 "Non-nil means activate single letter commands at beginning of a headline.
1245 This may also be a function to test for appropriate locations where speed
1246 commands should be active.
1248 For example, to activate speed commands when the point is on any
1249 star at the beginning of the headline, you can do this:
1251 (setq org-use-speed-commands
1252 (lambda () (and (looking-at org-outline-regexp) (looking-back \"^\\**\"))))"
1253 :group 'org-structure
1254 :type '(choice
1255 (const :tag "Never" nil)
1256 (const :tag "At beginning of headline stars" t)
1257 (function)))
1259 (defcustom org-speed-commands-user nil
1260 "Alist of additional speed commands.
1261 This list will be checked before `org-speed-commands-default'
1262 when the variable `org-use-speed-commands' is non-nil
1263 and when the cursor is at the beginning of a headline.
1264 The car if each entry is a string with a single letter, which must
1265 be assigned to `self-insert-command' in the global map.
1266 The cdr is either a command to be called interactively, a function
1267 to be called, or a form to be evaluated.
1268 An entry that is just a list with a single string will be interpreted
1269 as a descriptive headline that will be added when listing the speed
1270 commands in the Help buffer using the `?' speed command."
1271 :group 'org-structure
1272 :type '(repeat :value ("k" . ignore)
1273 (choice :value ("k" . ignore)
1274 (list :tag "Descriptive Headline" (string :tag "Headline"))
1275 (cons :tag "Letter and Command"
1276 (string :tag "Command letter")
1277 (choice
1278 (function)
1279 (sexp))))))
1281 (defcustom org-bookmark-names-plist
1282 '(:last-capture "org-capture-last-stored"
1283 :last-refile "org-refile-last-stored"
1284 :last-capture-marker "org-capture-last-stored-marker")
1285 "Names for bookmarks automatically set by some Org commands.
1286 This can provide strings as names for a number of bookmarks Org sets
1287 automatically. The following keys are currently implemented:
1288 :last-capture
1289 :last-capture-marker
1290 :last-refile
1291 When a key does not show up in the property list, the corresponding bookmark
1292 is not set."
1293 :group 'org-structure
1294 :type 'plist)
1296 (defgroup org-cycle nil
1297 "Options concerning visibility cycling in Org-mode."
1298 :tag "Org Cycle"
1299 :group 'org-structure)
1301 (defcustom org-cycle-skip-children-state-if-no-children t
1302 "Non-nil means skip CHILDREN state in entries that don't have any."
1303 :group 'org-cycle
1304 :type 'boolean)
1306 (defcustom org-cycle-max-level nil
1307 "Maximum level which should still be subject to visibility cycling.
1308 Levels higher than this will, for cycling, be treated as text, not a headline.
1309 When `org-odd-levels-only' is set, a value of N in this variable actually
1310 means 2N-1 stars as the limiting headline.
1311 When nil, cycle all levels.
1312 Note that the limiting level of cycling is also influenced by
1313 `org-inlinetask-min-level'. When `org-cycle-max-level' is not set but
1314 `org-inlinetask-min-level' is, cycling will be limited to levels one less
1315 than its value."
1316 :group 'org-cycle
1317 :type '(choice
1318 (const :tag "No limit" nil)
1319 (integer :tag "Maximum level")))
1321 (defcustom org-hide-block-startup nil
1322 "Non-nil means entering Org mode will fold all blocks.
1323 This can also be set in on a per-file basis with
1325 #+STARTUP: hideblocks
1326 #+STARTUP: showblocks"
1327 :group 'org-startup
1328 :group 'org-cycle
1329 :type 'boolean)
1331 (defcustom org-cycle-global-at-bob nil
1332 "Cycle globally if cursor is at beginning of buffer and not at a headline.
1333 This makes it possible to do global cycling without having to use S-TAB or
1334 \\[universal-argument] TAB. For this special case to work, the first line
1335 of the buffer must not be a headline -- it may be empty or some other text.
1336 When used in this way, `org-cycle-hook' is disabled temporarily to make
1337 sure the cursor stays at the beginning of the buffer. When this option is
1338 nil, don't do anything special at the beginning of the buffer."
1339 :group 'org-cycle
1340 :type 'boolean)
1342 (defcustom org-cycle-level-after-item/entry-creation t
1343 "Non-nil means cycle entry level or item indentation in new empty entries.
1345 When the cursor is at the end of an empty headline, i.e., with only stars
1346 and maybe a TODO keyword, TAB will then switch the entry to become a child,
1347 and then all possible ancestor states, before returning to the original state.
1348 This makes data entry extremely fast: M-RET to create a new headline,
1349 on TAB to make it a child, two or more tabs to make it a (grand-)uncle.
1351 When the cursor is at the end of an empty plain list item, one TAB will
1352 make it a subitem, two or more tabs will back up to make this an item
1353 higher up in the item hierarchy."
1354 :group 'org-cycle
1355 :type 'boolean)
1357 (defcustom org-cycle-emulate-tab t
1358 "Where should `org-cycle' emulate TAB.
1359 nil Never
1360 white Only in completely white lines
1361 whitestart Only at the beginning of lines, before the first non-white char
1362 t Everywhere except in headlines
1363 exc-hl-bol Everywhere except at the start of a headline
1364 If TAB is used in a place where it does not emulate TAB, the current subtree
1365 visibility is cycled."
1366 :group 'org-cycle
1367 :type '(choice (const :tag "Never" nil)
1368 (const :tag "Only in completely white lines" white)
1369 (const :tag "Before first char in a line" whitestart)
1370 (const :tag "Everywhere except in headlines" t)
1371 (const :tag "Everywhere except at bol in headlines" exc-hl-bol)))
1373 (defcustom org-cycle-separator-lines 2
1374 "Number of empty lines needed to keep an empty line between collapsed trees.
1375 If you leave an empty line between the end of a subtree and the following
1376 headline, this empty line is hidden when the subtree is folded.
1377 Org mode will leave (exactly) one empty line visible if the number of
1378 empty lines is equal or larger to the number given in this variable.
1379 So the default 2 means at least 2 empty lines after the end of a subtree
1380 are needed to produce free space between a collapsed subtree and the
1381 following headline.
1383 If the number is negative, and the number of empty lines is at least -N,
1384 all empty lines are shown.
1386 Special case: when 0, never leave empty lines in collapsed view."
1387 :group 'org-cycle
1388 :type 'integer)
1389 (put 'org-cycle-separator-lines 'safe-local-variable 'integerp)
1391 (defcustom org-pre-cycle-hook nil
1392 "Hook that is run before visibility cycling is happening.
1393 The function(s) in this hook must accept a single argument which indicates
1394 the new state that will be set right after running this hook. The
1395 argument is a symbol. Before a global state change, it can have the values
1396 `overview', `content', or `all'. Before a local state change, it can have
1397 the values `folded', `children', or `subtree'."
1398 :group 'org-cycle
1399 :type 'hook)
1401 (defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees
1402 org-cycle-hide-drawers
1403 org-cycle-show-empty-lines
1404 org-optimize-window-after-visibility-change)
1405 "Hook that is run after `org-cycle' has changed the buffer visibility.
1406 The function(s) in this hook must accept a single argument which indicates
1407 the new state that was set by the most recent `org-cycle' command. The
1408 argument is a symbol. After a global state change, it can have the values
1409 `overview', `contents', or `all'. After a local state change, it can have
1410 the values `folded', `children', or `subtree'."
1411 :group 'org-cycle
1412 :type 'hook
1413 :version "25.1"
1414 :package-version '(Org . "8.3"))
1416 (defgroup org-edit-structure nil
1417 "Options concerning structure editing in Org-mode."
1418 :tag "Org Edit Structure"
1419 :group 'org-structure)
1421 (defcustom org-odd-levels-only nil
1422 "Non-nil means skip even levels and only use odd levels for the outline.
1423 This has the effect that two stars are being added/taken away in
1424 promotion/demotion commands. It also influences how levels are
1425 handled by the exporters.
1426 Changing it requires restart of `font-lock-mode' to become effective
1427 for fontification also in regions already fontified.
1428 You may also set this on a per-file basis by adding one of the following
1429 lines to the buffer:
1431 #+STARTUP: odd
1432 #+STARTUP: oddeven"
1433 :group 'org-edit-structure
1434 :group 'org-appearance
1435 :type 'boolean)
1437 (defcustom org-adapt-indentation t
1438 "Non-nil means adapt indentation to outline node level.
1440 When this variable is set, Org assumes that you write outlines by
1441 indenting text in each node to align with the headline (after the
1442 stars). The following issues are influenced by this variable:
1444 - The indentation is increased by one space in a demotion
1445 command, and decreased by one in a promotion command. However,
1446 in the latter case, if shifting some line in the entry body
1447 would alter document structure (e.g., insert a new headline),
1448 indentation is not changed at all.
1450 - Property drawers and planning information is inserted indented
1451 when this variable is set. When nil, they will not be indented.
1453 - TAB indents a line relative to current level. The lines below
1454 a headline will be indented when this variable is set.
1456 Note that this is all about true indentation, by adding and
1457 removing space characters. See also `org-indent.el' which does
1458 level-dependent indentation in a virtual way, i.e. at display
1459 time in Emacs."
1460 :group 'org-edit-structure
1461 :type 'boolean)
1463 (defcustom org-special-ctrl-a/e nil
1464 "Non-nil means `C-a' and `C-e' behave specially in headlines and items.
1466 When t, `C-a' will bring back the cursor to the beginning of the
1467 headline text, i.e. after the stars and after a possible TODO
1468 keyword. In an item, this will be the position after bullet and
1469 check-box, if any. When the cursor is already at that position,
1470 another `C-a' will bring it to the beginning of the line.
1472 `C-e' will jump to the end of the headline, ignoring the presence
1473 of tags in the headline. A second `C-e' will then jump to the
1474 true end of the line, after any tags. This also means that, when
1475 this variable is non-nil, `C-e' also will never jump beyond the
1476 end of the heading of a folded section, i.e. not after the
1477 ellipses.
1479 When set to the symbol `reversed', the first `C-a' or `C-e' works
1480 normally, going to the true line boundary first. Only a directly
1481 following, identical keypress will bring the cursor to the
1482 special positions.
1484 This may also be a cons cell where the behavior for `C-a' and
1485 `C-e' is set separately."
1486 :group 'org-edit-structure
1487 :type '(choice
1488 (const :tag "off" nil)
1489 (const :tag "on: after stars/bullet and before tags first" t)
1490 (const :tag "reversed: true line boundary first" reversed)
1491 (cons :tag "Set C-a and C-e separately"
1492 (choice :tag "Special C-a"
1493 (const :tag "off" nil)
1494 (const :tag "on: after stars/bullet first" t)
1495 (const :tag "reversed: before stars/bullet first" reversed))
1496 (choice :tag "Special C-e"
1497 (const :tag "off" nil)
1498 (const :tag "on: before tags first" t)
1499 (const :tag "reversed: after tags first" reversed)))))
1500 (defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e)
1502 (defcustom org-special-ctrl-k nil
1503 "Non-nil means `C-k' will behave specially in headlines.
1504 When nil, `C-k' will call the default `kill-line' command.
1505 When t, the following will happen while the cursor is in the headline:
1507 - When the cursor is at the beginning of a headline, kill the entire
1508 line and possible the folded subtree below the line.
1509 - When in the middle of the headline text, kill the headline up to the tags.
1510 - When after the headline text, kill the tags."
1511 :group 'org-edit-structure
1512 :type 'boolean)
1514 (defcustom org-ctrl-k-protect-subtree nil
1515 "Non-nil means, do not delete a hidden subtree with C-k.
1516 When set to the symbol `error', simply throw an error when C-k is
1517 used to kill (part-of) a headline that has hidden text behind it.
1518 Any other non-nil value will result in a query to the user, if it is
1519 OK to kill that hidden subtree. When nil, kill without remorse."
1520 :group 'org-edit-structure
1521 :version "24.1"
1522 :type '(choice
1523 (const :tag "Do not protect hidden subtrees" nil)
1524 (const :tag "Protect hidden subtrees with a security query" t)
1525 (const :tag "Never kill a hidden subtree with C-k" error)))
1527 (defcustom org-special-ctrl-o t
1528 "Non-nil means, make `C-o' insert a row in tables."
1529 :group 'org-edit-structure
1530 :type 'boolean)
1532 (defcustom org-catch-invisible-edits nil
1533 "Check if in invisible region before inserting or deleting a character.
1534 Valid values are:
1536 nil Do not check, so just do invisible edits.
1537 error Throw an error and do nothing.
1538 show Make point visible, and do the requested edit.
1539 show-and-error Make point visible, then throw an error and abort the edit.
1540 smart Make point visible, and do insertion/deletion if it is
1541 adjacent to visible text and the change feels predictable.
1542 Never delete a previously invisible character or add in the
1543 middle or right after an invisible region. Basically, this
1544 allows insertion and backward-delete right before ellipses.
1545 FIXME: maybe in this case we should not even show?"
1546 :group 'org-edit-structure
1547 :version "24.1"
1548 :type '(choice
1549 (const :tag "Do not check" nil)
1550 (const :tag "Throw error when trying to edit" error)
1551 (const :tag "Unhide, but do not do the edit" show-and-error)
1552 (const :tag "Show invisible part and do the edit" show)
1553 (const :tag "Be smart and do the right thing" smart)))
1555 (defcustom org-yank-folded-subtrees t
1556 "Non-nil means when yanking subtrees, fold them.
1557 If the kill is a single subtree, or a sequence of subtrees, i.e. if
1558 it starts with a heading and all other headings in it are either children
1559 or siblings, then fold all the subtrees. However, do this only if no
1560 text after the yank would be swallowed into a folded tree by this action."
1561 :group 'org-edit-structure
1562 :type 'boolean)
1564 (defcustom org-yank-adjusted-subtrees nil
1565 "Non-nil means when yanking subtrees, adjust the level.
1566 With this setting, `org-paste-subtree' is used to insert the subtree, see
1567 this function for details."
1568 :group 'org-edit-structure
1569 :type 'boolean)
1571 (defcustom org-M-RET-may-split-line '((default . t))
1572 "Non-nil means M-RET will split the line at the cursor position.
1573 When nil, it will go to the end of the line before making a
1574 new line.
1575 You may also set this option in a different way for different
1576 contexts. Valid contexts are:
1578 headline when creating a new headline
1579 item when creating a new item
1580 table in a table field
1581 default the value to be used for all contexts not explicitly
1582 customized"
1583 :group 'org-structure
1584 :group 'org-table
1585 :type '(choice
1586 (const :tag "Always" t)
1587 (const :tag "Never" nil)
1588 (repeat :greedy t :tag "Individual contexts"
1589 (cons
1590 (choice :tag "Context"
1591 (const headline)
1592 (const item)
1593 (const table)
1594 (const default))
1595 (boolean)))))
1598 (defcustom org-insert-heading-respect-content nil
1599 "Non-nil means insert new headings after the current subtree.
1600 When nil, the new heading is created directly after the current line.
1601 The commands \\[org-insert-heading-respect-content] and \\[org-insert-todo-heading-respect-content] turn
1602 this variable on for the duration of the command."
1603 :group 'org-structure
1604 :type 'boolean)
1606 (defcustom org-blank-before-new-entry '((heading . auto)
1607 (plain-list-item . auto))
1608 "Should `org-insert-heading' leave a blank line before new heading/item?
1609 The value is an alist, with `heading' and `plain-list-item' as CAR,
1610 and a boolean flag as CDR. The cdr may also be the symbol `auto', in
1611 which case Org will look at the surrounding headings/items and try to
1612 make an intelligent decision whether to insert a blank line or not."
1613 :group 'org-edit-structure
1614 :type '(list
1615 (cons (const heading)
1616 (choice (const :tag "Never" nil)
1617 (const :tag "Always" t)
1618 (const :tag "Auto" auto)))
1619 (cons (const plain-list-item)
1620 (choice (const :tag "Never" nil)
1621 (const :tag "Always" t)
1622 (const :tag "Auto" auto)))))
1624 (defcustom org-insert-heading-hook nil
1625 "Hook being run after inserting a new heading."
1626 :group 'org-edit-structure
1627 :type 'hook)
1629 (defcustom org-enable-fixed-width-editor t
1630 "Non-nil means lines starting with \":\" are treated as fixed-width.
1631 This currently only means they are never auto-wrapped.
1632 When nil, such lines will be treated like ordinary lines."
1633 :group 'org-edit-structure
1634 :type 'boolean)
1636 (defcustom org-goto-auto-isearch t
1637 "Non-nil means typing characters in `org-goto' starts incremental search.
1638 When nil, you can use these keybindings to navigate the buffer:
1640 q Quit the org-goto interface
1641 n Go to the next visible heading
1642 p Go to the previous visible heading
1643 f Go one heading forward on same level
1644 b Go one heading backward on same level
1645 u Go one heading up"
1646 :group 'org-edit-structure
1647 :type 'boolean)
1649 (defgroup org-sparse-trees nil
1650 "Options concerning sparse trees in Org-mode."
1651 :tag "Org Sparse Trees"
1652 :group 'org-structure)
1654 (defcustom org-highlight-sparse-tree-matches t
1655 "Non-nil means highlight all matches that define a sparse tree.
1656 The highlights will automatically disappear the next time the buffer is
1657 changed by an edit command."
1658 :group 'org-sparse-trees
1659 :type 'boolean)
1661 (defcustom org-remove-highlights-with-change t
1662 "Non-nil means any change to the buffer will remove temporary highlights.
1663 \\<org-mode-map>\
1664 Such highlights are created by `org-occur' and `org-clock-display'.
1665 When nil, `\\[org-ctrl-c-ctrl-c]' needs to be used \
1666 to get rid of the highlights.
1667 The highlights created by `org-toggle-latex-fragment' always need
1668 `\\[org-toggle-latex-fragment]' to be removed."
1669 :group 'org-sparse-trees
1670 :group 'org-time
1671 :type 'boolean)
1673 (defcustom org-occur-case-fold-search t
1674 "Non-nil means `org-occur' should be case-insensitive.
1675 If set to `smart' the search will be case-insensitive only if it
1676 doesn't specify any upper case character."
1677 :group 'org-sparse-trees
1678 :version "25.1"
1679 :type '(choice
1680 (const :tag "Case-sensitive" nil)
1681 (const :tag "Case-insensitive" t)
1682 (const :tag "Case-insensitive for lower case searches only" 'smart)))
1684 (defcustom org-occur-hook '(org-first-headline-recenter)
1685 "Hook that is run after `org-occur' has constructed a sparse tree.
1686 This can be used to recenter the window to show as much of the structure
1687 as possible."
1688 :group 'org-sparse-trees
1689 :type 'hook)
1691 (defgroup org-imenu-and-speedbar nil
1692 "Options concerning imenu and speedbar in Org-mode."
1693 :tag "Org Imenu and Speedbar"
1694 :group 'org-structure)
1696 (defcustom org-imenu-depth 2
1697 "The maximum level for Imenu access to Org headlines.
1698 This also applied for speedbar access."
1699 :group 'org-imenu-and-speedbar
1700 :type 'integer)
1702 (defgroup org-table nil
1703 "Options concerning tables in Org-mode."
1704 :tag "Org Table"
1705 :group 'org)
1707 (defcustom org-enable-table-editor 'optimized
1708 "Non-nil means lines starting with \"|\" are handled by the table editor.
1709 When nil, such lines will be treated like ordinary lines.
1711 When equal to the symbol `optimized', the table editor will be optimized to
1712 do the following:
1713 - Automatic overwrite mode in front of whitespace in table fields.
1714 This makes the structure of the table stay in tact as long as the edited
1715 field does not exceed the column width.
1716 - Minimize the number of realigns. Normally, the table is aligned each time
1717 TAB or RET are pressed to move to another field. With optimization this
1718 happens only if changes to a field might have changed the column width.
1719 Optimization requires replacing the functions `self-insert-command',
1720 `delete-char', and `backward-delete-char' in Org buffers, with a
1721 slight (in fact: unnoticeable) speed impact for normal typing. Org is very
1722 good at guessing when a re-align will be necessary, but you can always
1723 force one with \\[org-ctrl-c-ctrl-c].
1725 If you would like to use the optimized version in Org-mode, but the
1726 un-optimized version in OrgTbl-mode, see the variable `orgtbl-optimized'.
1728 This variable can be used to turn on and off the table editor during a session,
1729 but in order to toggle optimization, a restart is required.
1731 See also the variable `org-table-auto-blank-field'."
1732 :group 'org-table
1733 :type '(choice
1734 (const :tag "off" nil)
1735 (const :tag "on" t)
1736 (const :tag "on, optimized" optimized)))
1738 (defcustom org-self-insert-cluster-for-undo nil
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-parameters
1763 '(("doi" :follow org--open-doi-link)
1764 ("elisp" :follow org--open-elisp-link)
1765 ("file" :complete org-file-complete-link)
1766 ("ftp" :follow (lambda (path) (browse-url (concat "ftp:" path))))
1767 ("help" :follow org--open-help-link)
1768 ("http" :follow (lambda (path) (browse-url (concat "http:" path))))
1769 ("https" :follow (lambda (path) (browse-url (concat "https:" path))))
1770 ("mailto" :follow (lambda (path) (browse-url (concat "mailto:" path))))
1771 ("message" :follow (lambda (path) (browse-url (concat "message:" path))))
1772 ("news" :follow (lambda (path) (browse-url (concat "news:" path))))
1773 ("shell" :follow org--open-shell-link))
1774 "An alist of properties that defines all the links in Org mode.
1775 The key in each association is a string of the link type.
1776 Subsequent optional elements make up a p-list of link properties.
1778 :follow - A function that takes the link path as an argument.
1780 :export - A function that takes the link path, description and
1781 export-backend as arguments.
1783 :store - A function responsible for storing the link. See the
1784 function `org-store-link-functions'.
1786 :complete - A function that inserts a link with completion. The
1787 function takes one optional prefix arg.
1789 :face - A face for the link, or a function that returns a face.
1790 The function takes one argument which is the link path. The
1791 default face is `org-link'.
1793 :mouse-face - The mouse-face. The default is `highlight'.
1795 :display - `full' will not fold the link in descriptive
1796 display. Default is `org-link'.
1798 :help-echo - A string or function that takes (window object position)
1799 as arguments and returns a string.
1801 :keymap - A keymap that is active on the link. The default is
1802 `org-mouse-map'.
1804 :htmlize-link - A function for the htmlize-link. Defaults
1805 to (list :uri \"type:path\")
1807 :activate-func - A function to run at the end of font-lock
1808 activation. The function must accept (link-start link-end path bracketp)
1809 as arguments."
1810 :group 'org-link
1811 :type '(alist :tag "Link display parameters"
1812 :value-type plist))
1814 (defun org-link-get-parameter (type key)
1815 "Get TYPE link property for KEY.
1816 TYPE is a string and KEY is a plist keyword."
1817 (plist-get
1818 (cdr (assoc type org-link-parameters))
1819 key))
1821 (defun org-link-set-parameters (type &rest parameters)
1822 "Set link TYPE properties to PARAMETERS.
1823 PARAMETERS should be :key val pairs."
1824 (let ((data (assoc type org-link-parameters)))
1825 (if data (setcdr data (org-combine-plists (cdr data) parameters))
1826 (push (cons type parameters) org-link-parameters)
1827 (org-make-link-regexps)
1828 (org-element-update-syntax))))
1830 (defun org-link-types ()
1831 "Return a list of known link types."
1832 (mapcar #'car org-link-parameters))
1834 (defcustom org-link-abbrev-alist nil
1835 "Alist of link abbreviations.
1836 The car of each element is a string, to be replaced at the start of a link.
1837 The cdrs are replacement values, like (\"linkkey\" . REPLACE). Abbreviated
1838 links in Org buffers can have an optional tag after a double colon, e.g.,
1840 [[linkkey:tag][description]]
1842 The `linkkey' must be a word word, starting with a letter, followed
1843 by letters, numbers, `-' or `_'.
1845 If REPLACE is a string, the tag will simply be appended to create the link.
1846 If the string contains \"%s\", the tag will be inserted there. If the string
1847 contains \"%h\", it will cause a url-encoded version of the tag to be inserted
1848 at that point (see the function `url-hexify-string'). If the string contains
1849 the specifier \"%(my-function)\", then the custom function `my-function' will
1850 be invoked: this function takes the tag as its only argument and must return
1851 a string.
1853 REPLACE may also be a function that will be called with the tag as the
1854 only argument to create the link, which should be returned as a string.
1856 See the manual for examples."
1857 :group 'org-link
1858 :type '(repeat
1859 (cons
1860 (string :tag "Protocol")
1861 (choice
1862 (string :tag "Format")
1863 (function)))))
1865 (defcustom org-descriptive-links t
1866 "Non-nil means Org will display descriptive links.
1867 E.g. [[][Org website]] will be displayed as
1868 \"Org Website\", hiding the link itself and just displaying its
1869 description. When set to nil, Org will display the full links
1870 literally.
1872 You can interactively set the value of this variable by calling
1873 `org-toggle-link-display' or from the menu Org>Hyperlinks menu."
1874 :group 'org-link
1875 :type 'boolean)
1877 (defcustom org-link-file-path-type 'adaptive
1878 "How the path name in file links should be stored.
1879 Valid values are:
1881 relative Relative to the current directory, i.e. the directory of the file
1882 into which the link is being inserted.
1883 absolute Absolute path, if possible with ~ for home directory.
1884 noabbrev Absolute path, no abbreviation of home directory.
1885 adaptive Use relative path for files in the current directory and sub-
1886 directories of it. For other files, use an absolute path."
1887 :group 'org-link
1888 :type '(choice
1889 (const relative)
1890 (const absolute)
1891 (const noabbrev)
1892 (const adaptive)))
1894 (defvaralias 'org-activate-links 'org-highlight-links)
1895 (defcustom org-highlight-links '(bracket angle plain radio tag date footnote)
1896 "Types of links that should be highlighted in Org files.
1898 This is a list of symbols, each one of them leading to the
1899 highlighting of a certain link type.
1901 You can still open links that are not highlighted.
1903 In principle, it does not hurt to turn on highlighting for all
1904 link types. There may be a small gain when turning off unused
1905 link types. The types are:
1907 bracket The recommended [[link][description]] or [[link]] links with hiding.
1908 angle Links in angular brackets that may contain whitespace like
1909 <bbdb:Carsten Dominik>.
1910 plain Plain links in normal text, no whitespace, like
1911 radio Text that is matched by a radio target, see manual for details.
1912 tag Tag settings in a headline (link to tag search).
1913 date Time stamps (link to calendar).
1914 footnote Footnote labels.
1916 If you set this variable during an Emacs session, use `org-mode-restart'
1917 in the Org buffer so that the change takes effect."
1918 :group 'org-link
1919 :group 'org-appearance
1920 :type '(set :greedy t
1921 (const :tag "Double bracket links" bracket)
1922 (const :tag "Angular bracket links" angle)
1923 (const :tag "Plain text links" plain)
1924 (const :tag "Radio target matches" radio)
1925 (const :tag "Tags" tag)
1926 (const :tag "Timestamps" date)
1927 (const :tag "Footnotes" footnote)))
1929 (defcustom org-make-link-description-function nil
1930 "Function to use for generating link descriptions from links.
1931 When nil, the link location will be used. This function must take
1932 two parameters: the first one is the link, the second one is the
1933 description generated by `org-insert-link'. The function should
1934 return the description to use."
1935 :group 'org-link
1936 :type '(choice (const nil) (function)))
1938 (defgroup org-link-store nil
1939 "Options concerning storing links in Org-mode."
1940 :tag "Org Store Link"
1941 :group 'org-link)
1943 (defcustom org-url-hexify-p t
1944 "When non-nil, hexify URL when creating a link."
1945 :type 'boolean
1946 :version "24.3"
1947 :group 'org-link-store)
1949 (defcustom org-email-link-description-format "Email %c: %.30s"
1950 "Format of the description part of a link to an email or usenet message.
1951 The following %-escapes will be replaced by corresponding information:
1953 %F full \"From\" field
1954 %f name, taken from \"From\" field, address if no name
1955 %T full \"To\" field
1956 %t first name in \"To\" field, address if no name
1957 %c correspondent. Usually \"from NAME\", but if you sent it yourself, it
1958 will be \"to NAME\". See also the variable `org-from-is-user-regexp'.
1959 %s subject
1960 %d date
1961 %m message-id.
1963 You may use normal field width specification between the % and the letter.
1964 This is for example useful to limit the length of the subject.
1966 Examples: \"%f on: %.30s\", \"Email from %f\", \"Email %c\""
1967 :group 'org-link-store
1968 :type 'string)
1970 (defcustom org-from-is-user-regexp
1971 (let (r1 r2)
1972 (when (and user-mail-address (not (string= user-mail-address "")))
1973 (setq r1 (concat "\\<" (regexp-quote user-mail-address) "\\>")))
1974 (when (and user-full-name (not (string= user-full-name "")))
1975 (setq r2 (concat "\\<" (regexp-quote user-full-name) "\\>")))
1976 (if (and r1 r2) (concat r1 "\\|" r2) (or r1 r2)))
1977 "Regexp matched against the \"From:\" header of an email or usenet message.
1978 It should match if the message is from the user him/herself."
1979 :group 'org-link-store
1980 :type 'regexp)
1982 (defcustom org-context-in-file-links t
1983 "Non-nil means file links from `org-store-link' contain context.
1984 A search string will be added to the file name with :: as separator and
1985 used to find the context when the link is activated by the command
1986 `org-open-at-point'. When this option is t, the entire active region
1987 will be placed in the search string of the file link. If set to a
1988 positive integer, only the first n lines of context will be stored.
1990 Using a prefix arg to the command \\[org-store-link] (`org-store-link')
1991 negates this setting for the duration of the command."
1992 :group 'org-link-store
1993 :type '(choice boolean integer))
1995 (defcustom org-keep-stored-link-after-insertion nil
1996 "Non-nil means keep link in list for entire session.
1998 The command `org-store-link' adds a link pointing to the current
1999 location to an internal list. These links accumulate during a session.
2000 The command `org-insert-link' can be used to insert links into any
2001 Org file (offering completion for all stored links). When this option
2002 is nil, every link which has been inserted once using \\[org-insert-link]
2003 will be removed from the list, to make completing the unused links
2004 more efficient."
2005 :group 'org-link-store
2006 :type 'boolean)
2008 (defgroup org-link-follow nil
2009 "Options concerning following links in Org-mode."
2010 :tag "Org Follow Link"
2011 :group 'org-link)
2013 (defcustom org-link-translation-function nil
2014 "Function to translate links with different syntax to Org syntax.
2015 This can be used to translate links created for example by the Planner
2016 or emacs-wiki packages to Org syntax.
2017 The function must accept two parameters, a TYPE containing the link
2018 protocol name like \"rmail\" or \"gnus\" as a string, and the linked path,
2019 which is everything after the link protocol. It should return a cons
2020 with possibly modified values of type and path.
2021 Org contains a function for this, so if you set this variable to
2022 `org-translate-link-from-planner', you should be able follow many
2023 links created by planner."
2024 :group 'org-link-follow
2025 :type '(choice (const nil) (function)))
2027 (defcustom org-follow-link-hook nil
2028 "Hook that is run after a link has been followed."
2029 :group 'org-link-follow
2030 :type 'hook)
2032 (defcustom org-tab-follows-link nil
2033 "Non-nil means on links TAB will follow the link.
2034 Needs to be set before org.el is loaded.
2035 This really should not be used, it does not make sense, and the
2036 implementation is bad."
2037 :group 'org-link-follow
2038 :type 'boolean)
2040 (defcustom org-return-follows-link nil
2041 "Non-nil means on links RET will follow the link.
2042 In tables, the special behavior of RET has precedence."
2043 :group 'org-link-follow
2044 :type 'boolean)
2046 (defcustom org-mouse-1-follows-link
2047 (if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t)
2048 "Non-nil means mouse-1 on a link will follow the link.
2049 A longer mouse click will still set point. Needs to be set
2050 before org.el is loaded."
2051 :group 'org-link-follow
2052 :version "24.4"
2053 :package-version '(Org . "8.3")
2054 :type '(choice
2055 (const :tag "A double click follows the link" double)
2056 (const :tag "Unconditionally follow the link with mouse-1" t)
2057 (integer :tag "mouse-1 click does not follow the link if longer than N ms" 450)))
2059 (defcustom org-mark-ring-length 4
2060 "Number of different positions to be recorded in the ring.
2061 Changing this requires a restart of Emacs to work correctly."
2062 :group 'org-link-follow
2063 :type 'integer)
2065 (defcustom org-link-search-must-match-exact-headline 'query-to-create
2066 "Non-nil means internal links in Org files must exactly match a headline.
2067 When nil, the link search tries to match a phrase with all words
2068 in the search text."
2069 :group 'org-link-follow
2070 :version "24.1"
2071 :type '(choice
2072 (const :tag "Use fuzzy text search" nil)
2073 (const :tag "Match only exact headline" t)
2074 (const :tag "Match exact headline or query to create it"
2075 query-to-create)))
2077 (defcustom org-link-frame-setup
2078 '((vm . vm-visit-folder-other-frame)
2079 (vm-imap . vm-visit-imap-folder-other-frame)
2080 (gnus . org-gnus-no-new-news)
2081 (file . find-file-other-window)
2082 (wl . wl-other-frame))
2083 "Setup the frame configuration for following links.
2084 When following a link with Emacs, it may often be useful to display
2085 this link in another window or frame. This variable can be used to
2086 set this up for the different types of links.
2087 For VM, use any of
2088 `vm-visit-folder'
2089 `vm-visit-folder-other-window'
2090 `vm-visit-folder-other-frame'
2091 For Gnus, use any of
2092 `gnus'
2093 `gnus-other-frame'
2094 `org-gnus-no-new-news'
2095 For FILE, use any of
2096 `find-file'
2097 `find-file-other-window'
2098 `find-file-other-frame'
2099 For Wanderlust use any of
2100 `wl'
2101 `wl-other-frame'
2102 For the calendar, use the variable `calendar-setup'.
2103 For BBDB, it is currently only possible to display the matches in
2104 another window."
2105 :group 'org-link-follow
2106 :type '(list
2107 (cons (const vm)
2108 (choice
2109 (const vm-visit-folder)
2110 (const vm-visit-folder-other-window)
2111 (const vm-visit-folder-other-frame)))
2112 (cons (const vm-imap)
2113 (choice
2114 (const vm-visit-imap-folder)
2115 (const vm-visit-imap-folder-other-window)
2116 (const vm-visit-imap-folder-other-frame)))
2117 (cons (const gnus)
2118 (choice
2119 (const gnus)
2120 (const gnus-other-frame)
2121 (const org-gnus-no-new-news)))
2122 (cons (const file)
2123 (choice
2124 (const find-file)
2125 (const find-file-other-window)
2126 (const find-file-other-frame)))
2127 (cons (const wl)
2128 (choice
2129 (const wl)
2130 (const wl-other-frame)))))
2132 (defcustom org-display-internal-link-with-indirect-buffer nil
2133 "Non-nil means use indirect buffer to display infile links.
2134 Activating internal links (from one location in a file to another location
2135 in the same file) normally just jumps to the location. When the link is
2136 activated with a \\[universal-argument] prefix (or with mouse-3), the link \
2137 is displayed in
2138 another window. When this option is set, the other window actually displays
2139 an indirect buffer clone of the current buffer, to avoid any visibility
2140 changes to the current buffer."
2141 :group 'org-link-follow
2142 :type 'boolean)
2144 (defcustom org-open-non-existing-files nil
2145 "Non-nil means `org-open-file' will open non-existing files.
2146 When nil, an error will be generated.
2147 This variable applies only to external applications because they
2148 might choke on non-existing files. If the link is to a file that
2149 will be opened in Emacs, the variable is ignored."
2150 :group 'org-link-follow
2151 :type 'boolean)
2153 (defcustom org-open-directory-means-index-dot-org nil
2154 "Non-nil means a link to a directory really means to
2155 When nil, following a directory link will run dired or open a finder/explorer
2156 window on that directory."
2157 :group 'org-link-follow
2158 :type 'boolean)
2160 (defcustom org-confirm-shell-link-function 'yes-or-no-p
2161 "Non-nil means ask for confirmation before executing shell links.
2162 Shell links can be dangerous: just think about a link
2164 [[shell:rm -rf ~/*][Google Search]]
2166 This link would show up in your Org document as \"Google Search\",
2167 but really it would remove your entire home directory.
2168 Therefore we advise against setting this variable to nil.
2169 Just change it to `y-or-n-p' if you want to confirm with a
2170 single keystroke rather than having to type \"yes\"."
2171 :group 'org-link-follow
2172 :type '(choice
2173 (const :tag "with yes-or-no (safer)" yes-or-no-p)
2174 (const :tag "with y-or-n (faster)" y-or-n-p)
2175 (const :tag "no confirmation (dangerous)" nil)))
2176 (put 'org-confirm-shell-link-function
2177 'safe-local-variable
2178 (lambda (x) (member x '(yes-or-no-p y-or-n-p))))
2180 (defcustom org-confirm-shell-link-not-regexp ""
2181 "A regexp to skip confirmation for shell links."
2182 :group 'org-link-follow
2183 :version "24.1"
2184 :type 'regexp)
2186 (defcustom org-confirm-elisp-link-function 'yes-or-no-p
2187 "Non-nil means ask for confirmation before executing Emacs Lisp links.
2188 Elisp links can be dangerous: just think about a link
2190 [[elisp:(shell-command \"rm -rf ~/*\")][Google Search]]
2192 This link would show up in your Org document as \"Google Search\",
2193 but really it would remove your entire home directory.
2194 Therefore we advise against setting this variable to nil.
2195 Just change it to `y-or-n-p' if you want to confirm with a
2196 single keystroke rather than having to type \"yes\"."
2197 :group 'org-link-follow
2198 :type '(choice
2199 (const :tag "with yes-or-no (safer)" yes-or-no-p)
2200 (const :tag "with y-or-n (faster)" y-or-n-p)
2201 (const :tag "no confirmation (dangerous)" nil)))
2202 (put 'org-confirm-shell-link-function
2203 'safe-local-variable
2204 (lambda (x) (member x '(yes-or-no-p y-or-n-p))))
2206 (defcustom org-confirm-elisp-link-not-regexp ""
2207 "A regexp to skip confirmation for Elisp links."
2208 :group 'org-link-follow
2209 :version "24.1"
2210 :type 'regexp)
2212 (defconst org-file-apps-defaults-gnu
2213 '((remote . emacs)
2214 (system . mailcap)
2215 (t . mailcap))
2216 "Default file applications on a UNIX or GNU/Linux system.
2217 See `org-file-apps'.")
2219 (defconst org-file-apps-defaults-macosx
2220 '((remote . emacs)
2221 (system . "open %s")
2222 ("ps.gz" . "gv %s")
2223 ("eps.gz" . "gv %s")
2224 ("dvi" . "xdvi %s")
2225 ("fig" . "xfig %s")
2226 (t . "open %s"))
2227 "Default file applications on a MacOS X system.
2228 The system \"open\" is known as a default, but we use X11 applications
2229 for some files for which the OS does not have a good default.
2230 See `org-file-apps'.")
2232 (defconst org-file-apps-defaults-windowsnt
2233 (list '(remote . emacs)
2234 (cons 'system (lambda (file _path)
2235 (with-no-warnings (w32-shell-execute "open" file))))
2236 (cons t (lambda (file _path)
2237 (with-no-warnings (w32-shell-execute "open" file)))))
2238 "Default file applications on a Windows NT system.
2239 The system \"open\" is used for most files.
2240 See `org-file-apps'.")
2242 (defcustom org-file-apps
2243 '((auto-mode . emacs)
2244 ("\\.mm\\'" . default)
2245 ("\\.x?html?\\'" . default)
2246 ("\\.pdf\\'" . default))
2247 "External applications for opening `file:path' items in a document.
2248 \\<org-mode-map>\
2250 Org mode uses system defaults for different file types, but
2251 you can use this variable to set the application for a given file
2252 extension. The entries in this list are cons cells where the car identifies
2253 files and the cdr the corresponding command.
2255 Possible values for the file identifier are:
2257 \"string\" A string as a file identifier can be interpreted in different
2258 ways, depending on its contents:
2260 - Alphanumeric characters only:
2261 Match links with this file extension.
2262 Example: (\"pdf\" . \"evince %s\")
2263 to open PDFs with evince.
2265 - Regular expression: Match links where the
2266 filename matches the regexp. If you want to
2267 use groups here, use shy groups.
2269 Example: (\"\\\\.x?html\\\\\\='\" . \"firefox %s\")
2270 (\"\\\\(?:xhtml\\\\|html\\\\)\\\\\\='\" . \"firefox %s\")
2271 to open *.html and *.xhtml with firefox.
2273 - Regular expression which contains (non-shy) groups:
2274 Match links where the whole link, including \"::\", and
2275 anything after that, matches the regexp.
2276 In a custom command string, %1, %2, etc. are replaced with
2277 the parts of the link that were matched by the groups.
2278 For backwards compatibility, if a command string is given
2279 that does not use any of the group matches, this case is
2280 handled identically to the second one (i.e. match against
2281 file name only).
2282 In a custom function, you can access the group matches with
2283 \(match-string n link).
2285 Example: (\"\\\\.pdf::\\\\(\\\\d+\\\\)\\\\\\='\" . \
2286 \"evince -p %1 %s\")
2287 to open [[file:document.pdf::5]] with evince at page 5.
2289 `directory' Matches a directory
2290 `remote' Matches a remote file, accessible through tramp or efs.
2291 Remote files most likely should be visited through Emacs
2292 because external applications cannot handle such paths.
2293 `auto-mode' Matches files that are matched by any entry in `auto-mode-alist',
2294 so all files Emacs knows how to handle. Using this with
2295 command `emacs' will open most files in Emacs. Beware that this
2296 will also open html files inside Emacs, unless you add
2297 \(\"html\" . default) to the list as well.
2298 `system' The system command to open files, like `open' on Windows
2299 and Mac OS X, and mailcap under GNU/Linux. This is the command
2300 that will be selected if you call \\[org-open-at-point] with a double
2301 \\[universal-argument] \\[universal-argument] prefix.
2302 t Default for files not matched by any of the other options.
2304 Possible values for the command are:
2306 `emacs' The file will be visited by the current Emacs process.
2307 `default' Use the default application for this file type, which is the
2308 association for t in the list, most likely in the system-specific
2309 part. This can be used to overrule an unwanted setting in the
2310 system-specific variable.
2311 `system' Use the system command for opening files, like \"open\".
2312 This command is specified by the entry whose car is `system'.
2313 Most likely, the system-specific version of this variable
2314 does define this command, but you can overrule/replace it
2315 here.
2316 `mailcap' Use command specified in the mailcaps.
2317 string A command to be executed by a shell; %s will be replaced
2318 by the path to the file.
2319 function A Lisp function, which will be called with two arguments:
2320 the file path and the original link string, without the
2321 \"file:\" prefix.
2323 For more examples, see the system specific constants
2324 `org-file-apps-defaults-macosx'
2325 `org-file-apps-defaults-windowsnt'
2326 `org-file-apps-defaults-gnu'."
2327 :group 'org-link-follow
2328 :type '(repeat
2329 (cons (choice :value ""
2330 (string :tag "Extension")
2331 (const :tag "System command to open files" system)
2332 (const :tag "Default for unrecognized files" t)
2333 (const :tag "Remote file" remote)
2334 (const :tag "Links to a directory" directory)
2335 (const :tag "Any files that have Emacs modes"
2336 auto-mode))
2337 (choice :value ""
2338 (const :tag "Visit with Emacs" emacs)
2339 (const :tag "Use default" default)
2340 (const :tag "Use the system command" system)
2341 (string :tag "Command")
2342 (function :tag "Function")))))
2344 (defcustom org-doi-server-url ""
2345 "The URL of the DOI server."
2346 :type 'string
2347 :version "24.3"
2348 :group 'org-link-follow)
2350 (defgroup org-refile nil
2351 "Options concerning refiling entries in Org-mode."
2352 :tag "Org Refile"
2353 :group 'org)
2355 (defcustom org-directory "~/org"
2356 "Directory with Org files.
2357 This is just a default location to look for Org files. There is no need
2358 at all to put your files into this directory. It is used in the
2359 following situations:
2361 1. When a capture template specifies a target file that is not an
2362 absolute path. The path will then be interpreted relative to
2363 `org-directory'
2364 2. When the value of variable `org-agenda-files' is a single file, any
2365 relative paths in this file will be taken as relative to
2366 `org-directory'."
2367 :group 'org-refile
2368 :group 'org-capture
2369 :type 'directory)
2371 (defcustom org-default-notes-file (convert-standard-filename "~/.notes")
2372 "Default target for storing notes.
2373 Used as a fall back file for org-capture.el, for templates that
2374 do not specify a target file."
2375 :group 'org-refile
2376 :group 'org-capture
2377 :type 'file)
2379 (defcustom org-goto-interface 'outline
2380 "The default interface to be used for `org-goto'.
2381 Allowed values are:
2382 outline The interface shows an outline of the relevant file
2383 and the correct heading is found by moving through
2384 the outline or by searching with incremental search.
2385 outline-path-completion Headlines in the current buffer are offered via
2386 completion. This is the interface also used by
2387 the refile command."
2388 :group 'org-refile
2389 :type '(choice
2390 (const :tag "Outline" outline)
2391 (const :tag "Outline-path-completion" outline-path-completion)))
2393 (defcustom org-goto-max-level 5
2394 "Maximum target level when running `org-goto' with refile interface."
2395 :group 'org-refile
2396 :type 'integer)
2398 (defcustom org-reverse-note-order nil
2399 "Non-nil means store new notes at the beginning of a file or entry.
2400 When nil, new notes will be filed to the end of a file or entry.
2401 This can also be a list with cons cells of regular expressions that
2402 are matched against file names, and values."
2403 :group 'org-capture
2404 :group 'org-refile
2405 :type '(choice
2406 (const :tag "Reverse always" t)
2407 (const :tag "Reverse never" nil)
2408 (repeat :tag "By file name regexp"
2409 (cons regexp boolean))))
2411 (defcustom org-log-refile nil
2412 "Information to record when a task is refiled.
2414 Possible values are:
2416 nil Don't add anything
2417 time Add a time stamp to the task
2418 note Prompt for a note and add it with template `org-log-note-headings'
2420 This option can also be set with on a per-file-basis with
2422 #+STARTUP: nologrefile
2423 #+STARTUP: logrefile
2424 #+STARTUP: lognoterefile
2426 You can have local logging settings for a subtree by setting the LOGGING
2427 property to one or more of these keywords.
2429 When bulk-refiling from the agenda, the value `note' is forbidden and
2430 will temporarily be changed to `time'."
2431 :group 'org-refile
2432 :group 'org-progress
2433 :version "24.1"
2434 :type '(choice
2435 (const :tag "No logging" nil)
2436 (const :tag "Record timestamp" time)
2437 (const :tag "Record timestamp with note." note)))
2439 (defcustom org-refile-targets nil
2440 "Targets for refiling entries with \\[org-refile].
2441 This is a list of cons cells. Each cell contains:
2442 - a specification of the files to be considered, either a list of files,
2443 or a symbol whose function or variable value will be used to retrieve
2444 a file name or a list of file names. If you use `org-agenda-files' for
2445 that, all agenda files will be scanned for targets. Nil means consider
2446 headings in the current buffer.
2447 - A specification of how to find candidate refile targets. This may be
2448 any of:
2449 - a cons cell (:tag . \"TAG\") to identify refile targets by a tag.
2450 This tag has to be present in all target headlines, inheritance will
2451 not be considered.
2452 - a cons cell (:todo . \"KEYWORD\") to identify refile targets by
2453 todo keyword.
2454 - a cons cell (:regexp . \"REGEXP\") with a regular expression matching
2455 headlines that are refiling targets.
2456 - a cons cell (:level . N). Any headline of level N is considered a target.
2457 Note that, when `org-odd-levels-only' is set, level corresponds to
2458 order in hierarchy, not to the number of stars.
2459 - a cons cell (:maxlevel . N). Any headline with level <= N is a target.
2460 Note that, when `org-odd-levels-only' is set, level corresponds to
2461 order in hierarchy, not to the number of stars.
2463 Each element of this list generates a set of possible targets.
2464 The union of these sets is presented (with completion) to
2465 the user by `org-refile'.
2467 You can set the variable `org-refile-target-verify-function' to a function
2468 to verify each headline found by the simple criteria above.
2470 When this variable is nil, all top-level headlines in the current buffer
2471 are used, equivalent to the value `((nil . (:level . 1))'."
2472 :group 'org-refile
2473 :type '(repeat
2474 (cons
2475 (choice :value org-agenda-files
2476 (const :tag "All agenda files" org-agenda-files)
2477 (const :tag "Current buffer" nil)
2478 (function) (variable) (file))
2479 (choice :tag "Identify target headline by"
2480 (cons :tag "Specific tag" (const :value :tag) (string))
2481 (cons :tag "TODO keyword" (const :value :todo) (string))
2482 (cons :tag "Regular expression" (const :value :regexp) (regexp))
2483 (cons :tag "Level number" (const :value :level) (integer))
2484 (cons :tag "Max Level number" (const :value :maxlevel) (integer))))))
2486 (defcustom org-refile-target-verify-function nil
2487 "Function to verify if the headline at point should be a refile target.
2488 The function will be called without arguments, with point at the
2489 beginning of the headline. It should return t and leave point
2490 where it is if the headline is a valid target for refiling.
2492 If the target should not be selected, the function must return nil.
2493 In addition to this, it may move point to a place from where the search
2494 should be continued. For example, the function may decide that the entire
2495 subtree of the current entry should be excluded and move point to the end
2496 of the subtree."
2497 :group 'org-refile
2498 :type '(choice
2499 (const nil)
2500 (function)))
2502 (defcustom org-refile-use-cache nil
2503 "Non-nil means cache refile targets to speed up the process.
2504 \\<org-mode-map>\
2505 The cache for a particular file will be updated automatically when
2506 the buffer has been killed, or when any of the marker used for flagging
2507 refile targets no longer points at a live buffer.
2508 If you have added new entries to a buffer that might themselves be targets,
2509 you need to clear the cache manually by pressing `C-0 \\[org-refile]' or,
2510 if you find that easier, \
2511 `\\[universal-argument] \\[universal-argument] \\[universal-argument] \
2512 \\[org-refile]'."
2513 :group 'org-refile
2514 :version "24.1"
2515 :type 'boolean)
2517 (defcustom org-refile-use-outline-path nil
2518 "Non-nil means provide refile targets as paths.
2519 So a level 3 headline will be available as level1/level2/level3.
2521 When the value is `file', also include the file name (without directory)
2522 into the path. In this case, you can also stop the completion after
2523 the file name, to get entries inserted as top level in the file.
2525 When `full-file-path', include the full file path."
2526 :group 'org-refile
2527 :type '(choice
2528 (const :tag "Not" nil)
2529 (const :tag "Yes" t)
2530 (const :tag "Start with file name" file)
2531 (const :tag "Start with full file path" full-file-path)))
2533 (defcustom org-outline-path-complete-in-steps t
2534 "Non-nil means complete the outline path in hierarchical steps.
2535 When Org uses the refile interface to select an outline path (see
2536 `org-refile-use-outline-path'), the completion of the path can be
2537 done in a single go, or it can be done in steps down the headline
2538 hierarchy. Going in steps is probably the best if you do not use
2539 a special completion package like `ido' or `icicles'. However,
2540 when using these packages, going in one step can be very fast,
2541 while still showing the whole path to the entry."
2542 :group 'org-refile
2543 :type 'boolean)
2545 (defcustom org-refile-allow-creating-parent-nodes nil
2546 "Non-nil means allow the creation of new nodes as refile targets.
2547 New nodes are then created by adding \"/new node name\" to the completion
2548 of an existing node. When the value of this variable is `confirm',
2549 new node creation must be confirmed by the user (recommended).
2550 When nil, the completion must match an existing entry.
2552 Note that, if the new heading is not seen by the criteria
2553 listed in `org-refile-targets', multiple instances of the same
2554 heading would be created by trying again to file under the new
2555 heading."
2556 :group 'org-refile
2557 :type '(choice
2558 (const :tag "Never" nil)
2559 (const :tag "Always" t)
2560 (const :tag "Prompt for confirmation" confirm)))
2562 (defcustom org-refile-active-region-within-subtree nil
2563 "Non-nil means also refile active region within a subtree.
2565 By default `org-refile' doesn't allow refiling regions if they
2566 don't contain a set of subtrees, but it might be convenient to
2567 do so sometimes: in that case, the first line of the region is
2568 converted to a headline before refiling."
2569 :group 'org-refile
2570 :version "24.1"
2571 :type 'boolean)
2573 (defgroup org-todo nil
2574 "Options concerning TODO items in Org-mode."
2575 :tag "Org TODO"
2576 :group 'org)
2578 (defgroup org-progress nil
2579 "Options concerning Progress logging in Org-mode."
2580 :tag "Org Progress"
2581 :group 'org-time)
2583 (defvar org-todo-interpretation-widgets
2584 '((:tag "Sequence (cycling hits every state)" sequence)
2585 (:tag "Type (cycling directly to DONE)" type))
2586 "The available interpretation symbols for customizing `org-todo-keywords'.
2587 Interested libraries should add to this list.")
2589 (defcustom org-todo-keywords '((sequence "TODO" "DONE"))
2590 "List of TODO entry keyword sequences and their interpretation.
2591 \\<org-mode-map>This is a list of sequences.
2593 Each sequence starts with a symbol, either `sequence' or `type',
2594 indicating if the keywords should be interpreted as a sequence of
2595 action steps, or as different types of TODO items. The first
2596 keywords are states requiring action - these states will select a headline
2597 for inclusion into the global TODO list Org produces. If one of the
2598 \"keywords\" is the vertical bar, \"|\", the remaining keywords
2599 signify that no further action is necessary. If \"|\" is not found,
2600 the last keyword is treated as the only DONE state of the sequence.
2602 The command \\[org-todo] cycles an entry through these states, and one
2603 additional state where no keyword is present. For details about this
2604 cycling, see the manual.
2606 TODO keywords and interpretation can also be set on a per-file basis with
2607 the special #+SEQ_TODO and #+TYP_TODO lines.
2609 Each keyword can optionally specify a character for fast state selection
2610 \(in combination with the variable `org-use-fast-todo-selection')
2611 and specifiers for state change logging, using the same syntax that
2612 is used in the \"#+TODO:\" lines. For example, \"WAIT(w)\" says that
2613 the WAIT state can be selected with the \"w\" key. \"WAIT(w!)\"
2614 indicates to record a time stamp each time this state is selected.
2616 Each keyword may also specify if a timestamp or a note should be
2617 recorded when entering or leaving the state, by adding additional
2618 characters in the parenthesis after the keyword. This looks like this:
2619 \"WAIT(w@/!)\". \"@\" means to add a note (with time), \"!\" means to
2620 record only the time of the state change. With X and Y being either
2621 \"@\" or \"!\", \"X/Y\" means use X when entering the state, and use
2622 Y when leaving the state if and only if the *target* state does not
2623 define X. You may omit any of the fast-selection key or X or /Y,
2624 so WAIT(w@), WAIT(w/@) and WAIT(@/@) are all valid.
2626 For backward compatibility, this variable may also be just a list
2627 of keywords. In this case the interpretation (sequence or type) will be
2628 taken from the (otherwise obsolete) variable `org-todo-interpretation'."
2629 :group 'org-todo
2630 :group 'org-keywords
2631 :type '(choice
2632 (repeat :tag "Old syntax, just keywords"
2633 (string :tag "Keyword"))
2634 (repeat :tag "New syntax"
2635 (cons
2636 (choice
2637 :tag "Interpretation"
2638 ;;Quick and dirty way to see
2639 ;;`org-todo-interpretations'. This takes the
2640 ;;place of item arguments
2641 :convert-widget
2642 (lambda (widget)
2643 (widget-put widget
2644 :args (mapcar
2645 (lambda (x)
2646 (widget-convert
2647 (cons 'const x)))
2648 org-todo-interpretation-widgets))
2649 widget))
2650 (repeat
2651 (string :tag "Keyword"))))))
2653 (defvar-local org-todo-keywords-1 nil
2654 "All TODO and DONE keywords active in a buffer.")
2655 (defvar org-todo-keywords-for-agenda nil)
2656 (defvar org-done-keywords-for-agenda nil)
2657 (defvar org-todo-keyword-alist-for-agenda nil)
2658 (defvar org-tag-alist-for-agenda nil
2659 "Alist of all tags from all agenda files.")
2660 (defvar org-tag-groups-alist-for-agenda nil
2661 "Alist of all groups tags from all current agenda files.")
2662 (defvar-local org-tag-groups-alist nil)
2663 (defvar org-agenda-contributing-files nil)
2664 (defvar-local org-current-tag-alist nil
2665 "Alist of all tag groups in current buffer.
2666 This variable takes into consideration `org-tag-alist',
2667 `org-tag-persistent-alist' and TAGS keywords in the buffer.")
2668 (defvar-local org-not-done-keywords nil)
2669 (defvar-local org-done-keywords nil)
2670 (defvar-local org-todo-heads nil)
2671 (defvar-local org-todo-sets nil)
2672 (defvar-local org-todo-log-states nil)
2673 (defvar-local org-todo-kwd-alist nil)
2674 (defvar-local org-todo-key-alist nil)
2675 (defvar-local org-todo-key-trigger nil)
2677 (defcustom org-todo-interpretation 'sequence
2678 "Controls how TODO keywords are interpreted.
2679 This variable is in principle obsolete and is only used for
2680 backward compatibility, if the interpretation of todo keywords is
2681 not given already in `org-todo-keywords'. See that variable for
2682 more information."
2683 :group 'org-todo
2684 :group 'org-keywords
2685 :type '(choice (const sequence)
2686 (const type)))
2688 (defcustom org-use-fast-todo-selection t
2689 "\\<org-mode-map>\
2690 Non-nil means use the fast todo selection scheme with \\[org-todo].
2691 This variable describes if and under what circumstances the cycling
2692 mechanism for TODO keywords will be replaced by a single-key, direct
2693 selection scheme.
2695 When nil, fast selection is never used.
2697 When the symbol `prefix', it will be used when `org-todo' is called
2698 with a prefix argument, i.e. `\\[universal-argument] \\[org-todo]' \
2699 in an Org buffer, and
2700 `\\[universal-argument] t' in an agenda buffer.
2702 When t, fast selection is used by default. In this case, the prefix
2703 argument forces cycling instead.
2705 In all cases, the special interface is only used if access keys have
2706 actually been assigned by the user, i.e. if keywords in the configuration
2707 are followed by a letter in parenthesis, like TODO(t)."
2708 :group 'org-todo
2709 :type '(choice
2710 (const :tag "Never" nil)
2711 (const :tag "By default" t)
2712 (const :tag "Only with C-u C-c C-t" prefix)))
2714 (defcustom org-provide-todo-statistics t
2715 "Non-nil means update todo statistics after insert and toggle.
2716 ALL-HEADLINES means update todo statistics by including headlines
2717 with no TODO keyword as well, counting them as not done.
2718 A list of TODO keywords means the same, but skip keywords that are
2719 not in this list.
2720 When set to a list of two lists, the first list contains keywords
2721 to consider as TODO keywords, the second list contains keywords
2722 to consider as DONE keywords.
2724 When this is set, todo statistics is updated in the parent of the
2725 current entry each time a todo state is changed."
2726 :group 'org-todo
2727 :type '(choice
2728 (const :tag "Yes, only for TODO entries" t)
2729 (const :tag "Yes, including all entries" all-headlines)
2730 (repeat :tag "Yes, for TODOs in this list"
2731 (string :tag "TODO keyword"))
2732 (list :tag "Yes, for TODOs and DONEs in these lists"
2733 (repeat (string :tag "TODO keyword"))
2734 (repeat (string :tag "DONE keyword")))
2735 (other :tag "No TODO statistics" nil)))
2737 (defcustom org-hierarchical-todo-statistics t
2738 "Non-nil means TODO statistics covers just direct children.
2739 When nil, all entries in the subtree are considered.
2740 This has only an effect if `org-provide-todo-statistics' is set.
2741 To set this to nil for only a single subtree, use a COOKIE_DATA
2742 property and include the word \"recursive\" into the value."
2743 :group 'org-todo
2744 :type 'boolean)
2746 (defcustom org-after-todo-state-change-hook nil
2747 "Hook which is run after the state of a TODO item was changed.
2748 The new state (a string with a TODO keyword, or nil) is available in the
2749 Lisp variable `org-state'."
2750 :group 'org-todo
2751 :type 'hook)
2753 (defvar org-blocker-hook nil
2754 "Hook for functions that are allowed to block a state change.
2756 Functions in this hook should not modify the buffer.
2757 Each function gets as its single argument a property list,
2758 see `org-trigger-hook' for more information about this list.
2760 If any of the functions in this hook returns nil, the state change
2761 is blocked.")
2763 (defvar org-trigger-hook nil
2764 "Hook for functions that are triggered by a state change.
2766 Each function gets as its single argument a property list with at
2767 least the following elements:
2769 (:type type-of-change :position pos-at-entry-start
2770 :from old-state :to new-state)
2772 Depending on the type, more properties may be present.
2774 This mechanism is currently implemented for:
2776 TODO state changes
2777 ------------------
2778 :type todo-state-change
2779 :from previous state (keyword as a string), or nil, or a symbol
2780 `todo' or `done', to indicate the general type of state.
2781 :to new state, like in :from")
2783 (defcustom org-enforce-todo-dependencies nil
2784 "Non-nil means undone TODO entries will block switching the parent to DONE.
2785 Also, if a parent has an :ORDERED: property, switching an entry to DONE will
2786 be blocked if any prior sibling is not yet done.
2787 Finally, if the parent is blocked because of ordered siblings of its own,
2788 the child will also be blocked."
2789 :set (lambda (var val)
2790 (set var val)
2791 (if val
2792 (add-hook 'org-blocker-hook
2793 'org-block-todo-from-children-or-siblings-or-parent)
2794 (remove-hook 'org-blocker-hook
2795 'org-block-todo-from-children-or-siblings-or-parent)))
2796 :group 'org-todo
2797 :type 'boolean)
2799 (defcustom org-enforce-todo-checkbox-dependencies nil
2800 "Non-nil means unchecked boxes will block switching the parent to DONE.
2801 When this is nil, checkboxes have no influence on switching TODO states.
2802 When non-nil, you first need to check off all check boxes before the TODO
2803 entry can be switched to DONE.
2804 This variable needs to be set before org.el is loaded, and you need to
2805 restart Emacs after a change to make the change effective. The only way
2806 to change is while Emacs is running is through the customize interface."
2807 :set (lambda (var val)
2808 (set var val)
2809 (if val
2810 (add-hook 'org-blocker-hook
2811 'org-block-todo-from-checkboxes)
2812 (remove-hook 'org-blocker-hook
2813 'org-block-todo-from-checkboxes)))
2814 :group 'org-todo
2815 :type 'boolean)
2817 (defcustom org-treat-insert-todo-heading-as-state-change nil
2818 "Non-nil means inserting a TODO heading is treated as state change.
2819 So when the command \\[org-insert-todo-heading] is used, state change
2820 logging will apply if appropriate. When nil, the new TODO item will
2821 be inserted directly, and no logging will take place."
2822 :group 'org-todo
2823 :type 'boolean)
2825 (defcustom org-treat-S-cursor-todo-selection-as-state-change t
2826 "Non-nil means switching TODO states with S-cursor counts as state change.
2827 This is the default behavior. However, setting this to nil allows a
2828 convenient way to select a TODO state and bypass any logging associated
2829 with that."
2830 :group 'org-todo
2831 :type 'boolean)
2833 (defcustom org-todo-state-tags-triggers nil
2834 "Tag changes that should be triggered by TODO state changes.
2835 This is a list. Each entry is
2837 (state-change (tag . flag) .......)
2839 State-change can be a string with a state, and empty string to indicate the
2840 state that has no TODO keyword, or it can be one of the symbols `todo'
2841 or `done', meaning any not-done or done state, respectively."
2842 :group 'org-todo
2843 :group 'org-tags
2844 :type '(repeat
2845 (cons (choice :tag "When changing to"
2846 (const :tag "Not-done state" todo)
2847 (const :tag "Done state" done)
2848 (string :tag "State"))
2849 (repeat
2850 (cons :tag "Tag action"
2851 (string :tag "Tag")
2852 (choice (const :tag "Add" t) (const :tag "Remove" nil)))))))
2854 (defcustom org-log-done nil
2855 "Information to record when a task moves to the DONE state.
2857 Possible values are:
2859 nil Don't add anything, just change the keyword
2860 time Add a time stamp to the task
2861 note Prompt for a note and add it with template `org-log-note-headings'
2863 This option can also be set with on a per-file-basis with
2865 #+STARTUP: nologdone
2866 #+STARTUP: logdone
2867 #+STARTUP: lognotedone
2869 You can have local logging settings for a subtree by setting the LOGGING
2870 property to one or more of these keywords."
2871 :group 'org-todo
2872 :group 'org-progress
2873 :type '(choice
2874 (const :tag "No logging" nil)
2875 (const :tag "Record CLOSED timestamp" time)
2876 (const :tag "Record CLOSED timestamp with note." note)))
2878 ;; Normalize old uses of org-log-done.
2879 (cond
2880 ((eq org-log-done t) (setq org-log-done 'time))
2881 ((and (listp org-log-done) (memq 'done org-log-done))
2882 (setq org-log-done 'note)))
2884 (defcustom org-log-reschedule nil
2885 "Information to record when the scheduling date of a tasks is modified.
2887 Possible values are:
2889 nil Don't add anything, just change the date
2890 time Add a time stamp to the task
2891 note Prompt for a note and add it with template `org-log-note-headings'
2893 This option can also be set with on a per-file-basis with
2895 #+STARTUP: nologreschedule
2896 #+STARTUP: logreschedule
2897 #+STARTUP: lognotereschedule"
2898 :group 'org-todo
2899 :group 'org-progress
2900 :type '(choice
2901 (const :tag "No logging" nil)
2902 (const :tag "Record timestamp" time)
2903 (const :tag "Record timestamp with note." note)))
2905 (defcustom org-log-redeadline nil
2906 "Information to record when the deadline date of a tasks is modified.
2908 Possible values are:
2910 nil Don't add anything, just change the date
2911 time Add a time stamp to the task
2912 note Prompt for a note and add it with template `org-log-note-headings'
2914 This option can also be set with on a per-file-basis with
2916 #+STARTUP: nologredeadline
2917 #+STARTUP: logredeadline
2918 #+STARTUP: lognoteredeadline
2920 You can have local logging settings for a subtree by setting the LOGGING
2921 property to one or more of these keywords."
2922 :group 'org-todo
2923 :group 'org-progress
2924 :type '(choice
2925 (const :tag "No logging" nil)
2926 (const :tag "Record timestamp" time)
2927 (const :tag "Record timestamp with note." note)))
2929 (defcustom org-log-note-clock-out nil
2930 "Non-nil means record a note when clocking out of an item.
2931 This can also be configured on a per-file basis by adding one of
2932 the following lines anywhere in the buffer:
2934 #+STARTUP: lognoteclock-out
2935 #+STARTUP: nolognoteclock-out"
2936 :group 'org-todo
2937 :group 'org-progress
2938 :type 'boolean)
2940 (defcustom org-log-done-with-time t
2941 "Non-nil means the CLOSED time stamp will contain date and time.
2942 When nil, only the date will be recorded."
2943 :group 'org-progress
2944 :type 'boolean)
2946 (defcustom org-log-note-headings
2947 '((done . "CLOSING NOTE %t")
2948 (state . "State %-12s from %-12S %t")
2949 (note . "Note taken on %t")
2950 (reschedule . "Rescheduled from %S on %t")
2951 (delschedule . "Not scheduled, was %S on %t")
2952 (redeadline . "New deadline from %S on %t")
2953 (deldeadline . "Removed deadline, was %S on %t")
2954 (refile . "Refiled on %t")
2955 (clock-out . ""))
2956 "Headings for notes added to entries.
2958 The value is an alist, with the car being a symbol indicating the
2959 note context, and the cdr is the heading to be used. The heading
2960 may also be the empty string. The following placeholders can be
2961 used:
2963 %t a time stamp.
2964 %T an active time stamp instead the default inactive one
2965 %d a short-format time stamp.
2966 %D an active short-format time stamp.
2967 %s the new TODO state or time stamp (inactive), in double quotes.
2968 %S the old TODO state or time stamp (inactive), in double quotes.
2969 %u the user name.
2970 %U full user name.
2972 In fact, it is not a good idea to change the `state' entry,
2973 because Agenda Log mode depends on the format of these entries."
2974 :group 'org-todo
2975 :group 'org-progress
2976 :type '(list :greedy t
2977 (cons (const :tag "Heading when closing an item" done) string)
2978 (cons (const :tag
2979 "Heading when changing todo state (todo sequence only)"
2980 state) string)
2981 (cons (const :tag "Heading when just taking a note" note) string)
2982 (cons (const :tag "Heading when rescheduling" reschedule) string)
2983 (cons (const :tag "Heading when an item is no longer scheduled" delschedule) string)
2984 (cons (const :tag "Heading when changing deadline" redeadline) string)
2985 (cons (const :tag "Heading when deleting a deadline" deldeadline) string)
2986 (cons (const :tag "Heading when refiling" refile) string)
2987 (cons (const :tag "Heading when clocking out" clock-out) string)))
2989 (unless (assq 'note org-log-note-headings)
2990 (push '(note . "%t") org-log-note-headings))
2992 (defcustom org-log-into-drawer nil
2993 "Non-nil means insert state change notes and time stamps into a drawer.
2994 When nil, state changes notes will be inserted after the headline and
2995 any scheduling and clock lines, but not inside a drawer.
2997 The value of this variable should be the name of the drawer to use.
2998 LOGBOOK is proposed as the default drawer for this purpose, you can
2999 also set this to a string to define the drawer of your choice.
3001 A value of t is also allowed, representing \"LOGBOOK\".
3003 A value of t or nil can also be set with on a per-file-basis with
3005 #+STARTUP: logdrawer
3006 #+STARTUP: nologdrawer
3008 If this variable is set, `org-log-state-notes-insert-after-drawers'
3009 will be ignored.
3011 You can set the property LOG_INTO_DRAWER to overrule this setting for
3012 a subtree.
3014 Do not check directly this variable in a Lisp program. Call
3015 function `org-log-into-drawer' instead."
3016 :group 'org-todo
3017 :group 'org-progress
3018 :type '(choice
3019 (const :tag "Not into a drawer" nil)
3020 (const :tag "LOGBOOK" t)
3021 (string :tag "Other")))
3023 (defvaralias 'org-log-state-notes-into-drawer 'org-log-into-drawer)
3025 (defun org-log-into-drawer ()
3026 "Name of the log drawer, as a string, or nil.
3027 This is the value of `org-log-into-drawer'. However, if the
3028 current entry has or inherits a LOG_INTO_DRAWER property, it will
3029 be used instead of the default value."
3030 (let ((p (org-entry-get nil "LOG_INTO_DRAWER" 'inherit t)))
3031 (cond ((equal p "nil") nil)
3032 ((equal p "t") "LOGBOOK")
3033 ((stringp p) p)
3034 (p "LOGBOOK")
3035 ((stringp org-log-into-drawer) org-log-into-drawer)
3036 (org-log-into-drawer "LOGBOOK"))))
3038 (defcustom org-log-state-notes-insert-after-drawers nil
3039 "Non-nil means insert state change notes after any drawers in entry.
3040 Only the drawers that *immediately* follow the headline and the
3041 deadline/scheduled line are skipped.
3042 When nil, insert notes right after the heading and perhaps the line
3043 with deadline/scheduling if present.
3045 This variable will have no effect if `org-log-into-drawer' is
3046 set."
3047 :group 'org-todo
3048 :group 'org-progress
3049 :type 'boolean)
3051 (defcustom org-log-states-order-reversed t
3052 "Non-nil means the latest state note will be directly after heading.
3053 When nil, the state change notes will be ordered according to time.
3055 This option can also be set with on a per-file-basis with
3057 #+STARTUP: logstatesreversed
3058 #+STARTUP: nologstatesreversed"
3059 :group 'org-todo
3060 :group 'org-progress
3061 :type 'boolean)
3063 (defcustom org-todo-repeat-to-state nil
3064 "The TODO state to which a repeater should return the repeating task.
3065 By default this is the first task in a TODO sequence, or the previous state
3066 in a TODO_TYP set. But you can specify another task here.
3067 alternatively, set the :REPEAT_TO_STATE: property of the entry."
3068 :group 'org-todo
3069 :version "24.1"
3070 :type '(choice (const :tag "Head of sequence" nil)
3071 (string :tag "Specific state")))
3073 (defcustom org-log-repeat 'time
3074 "Non-nil means record moving through the DONE state when triggering repeat.
3075 An auto-repeating task is immediately switched back to TODO when
3076 marked DONE. If you are not logging state changes (by adding \"@\"
3077 or \"!\" to the TODO keyword definition), or set `org-log-done' to
3078 record a closing note, there will be no record of the task moving
3079 through DONE. This variable forces taking a note anyway.
3081 nil Don't force a record
3082 time Record a time stamp
3083 note Prompt for a note and add it with template `org-log-note-headings'
3085 This option can also be set with on a per-file-basis with
3087 #+STARTUP: nologrepeat
3088 #+STARTUP: logrepeat
3089 #+STARTUP: lognoterepeat
3091 You can have local logging settings for a subtree by setting the LOGGING
3092 property to one or more of these keywords."
3093 :group 'org-todo
3094 :group 'org-progress
3095 :type '(choice
3096 (const :tag "Don't force a record" nil)
3097 (const :tag "Force recording the DONE state" time)
3098 (const :tag "Force recording a note with the DONE state" note)))
3101 (defgroup org-priorities nil
3102 "Priorities in Org-mode."
3103 :tag "Org Priorities"
3104 :group 'org-todo)
3106 (defcustom org-enable-priority-commands t
3107 "Non-nil means priority commands are active.
3108 When nil, these commands will be disabled, so that you never accidentally
3109 set a priority."
3110 :group 'org-priorities
3111 :type 'boolean)
3113 (defcustom org-highest-priority ?A
3114 "The highest priority of TODO items. A character like ?A, ?B etc.
3115 Must have a smaller ASCII number than `org-lowest-priority'."
3116 :group 'org-priorities
3117 :type 'character)
3119 (defcustom org-lowest-priority ?C
3120 "The lowest priority of TODO items. A character like ?A, ?B etc.
3121 Must have a larger ASCII number than `org-highest-priority'."
3122 :group 'org-priorities
3123 :type 'character)
3125 (defcustom org-default-priority ?B
3126 "The default priority of TODO items.
3127 This is the priority an item gets if no explicit priority is given.
3128 When starting to cycle on an empty priority the first step in the cycle
3129 depends on `org-priority-start-cycle-with-default'. The resulting first
3130 step priority must not exceed the range from `org-highest-priority' to
3131 `org-lowest-priority' which means that `org-default-priority' has to be
3132 in this range exclusive or inclusive the range boundaries. Else the
3133 first step refuses to set the default and the second will fall back
3134 to (depending on the command used) the highest or lowest priority."
3135 :group 'org-priorities
3136 :type 'character)
3138 (defcustom org-priority-start-cycle-with-default t
3139 "Non-nil means start with default priority when starting to cycle.
3140 When this is nil, the first step in the cycle will be (depending on the
3141 command used) one higher or lower than the default priority.
3142 See also `org-default-priority'."
3143 :group 'org-priorities
3144 :type 'boolean)
3146 (defcustom org-get-priority-function nil
3147 "Function to extract the priority from a string.
3148 The string is normally the headline. If this is nil Org computes the
3149 priority from the priority cookie like [#A] in the headline. It returns
3150 an integer, increasing by 1000 for each priority level.
3151 The user can set a different function here, which should take a string
3152 as an argument and return the numeric priority."
3153 :group 'org-priorities
3154 :version "24.1"
3155 :type '(choice
3156 (const nil)
3157 (function)))
3159 (defgroup org-time nil
3160 "Options concerning time stamps and deadlines in Org-mode."
3161 :tag "Org Time"
3162 :group 'org)
3164 (defcustom org-time-stamp-rounding-minutes '(0 5)
3165 "Number of minutes to round time stamps to.
3166 \\<org-mode-map>\
3167 These are two values, the first applies when first creating a time stamp.
3168 The second applies when changing it with the commands `S-up' and `S-down'.
3169 When changing the time stamp, this means that it will change in steps
3170 of N minutes, as given by the second value.
3172 When a setting is 0 or 1, insert the time unmodified. Useful rounding
3173 numbers should be factors of 60, so for example 5, 10, 15.
3175 When this is larger than 1, you can still force an exact time stamp by using
3176 a double prefix argument to a time stamp command like \
3177 `\\[org-time-stamp]' or `\\[org-time-stamp-inactive],
3178 and by using a prefix arg to `S-up/down' to specify the exact number
3179 of minutes to shift."
3180 :group 'org-time
3181 :get (lambda (var) ; Make sure both elements are there
3182 (if (integerp (default-value var))
3183 (list (default-value var) 5)
3184 (default-value var)))
3185 :type '(list
3186 (integer :tag "when inserting times")
3187 (integer :tag "when modifying times")))
3189 ;; Normalize old customizations of this variable.
3190 (when (integerp org-time-stamp-rounding-minutes)
3191 (setq org-time-stamp-rounding-minutes
3192 (list org-time-stamp-rounding-minutes
3193 org-time-stamp-rounding-minutes)))
3195 (defcustom org-display-custom-times nil
3196 "Non-nil means overlay custom formats over all time stamps.
3197 The formats are defined through the variable `org-time-stamp-custom-formats'.
3198 To turn this on on a per-file basis, insert anywhere in the file:
3199 #+STARTUP: customtime"
3200 :group 'org-time
3201 :set 'set-default
3202 :type 'sexp)
3203 (make-variable-buffer-local 'org-display-custom-times)
3205 (defcustom org-time-stamp-custom-formats
3206 '("<%m/%d/%y %a>" . "<%m/%d/%y %a %H:%M>") ; american
3207 "Custom formats for time stamps. See `format-time-string' for the syntax.
3208 These are overlaid over the default ISO format if the variable
3209 `org-display-custom-times' is set. Time like %H:%M should be at the
3210 end of the second format. The custom formats are also honored by export
3211 commands, if custom time display is turned on at the time of export."
3212 :group 'org-time
3213 :type 'sexp)
3215 (defun org-time-stamp-format (&optional long inactive)
3216 "Get the right format for a time string."
3217 (let ((f (if long (cdr org-time-stamp-formats)
3218 (car org-time-stamp-formats))))
3219 (if inactive
3220 (concat "[" (substring f 1 -1) "]")
3221 f)))
3223 (defcustom org-time-clocksum-format
3224 '(:days "%dd " :hours "%d" :require-hours t :minutes ":%02d" :require-minutes t)
3225 "The format string used when creating CLOCKSUM lines.
3226 This is also used when Org mode generates a time duration.
3228 The value can be a single format string containing two
3229 %-sequences, which will be filled with the number of hours and
3230 minutes in that order.
3232 Alternatively, the value can be a plist associating any of the
3233 keys :years, :months, :weeks, :days, :hours or :minutes with
3234 format strings. The time duration is formatted using only the
3235 time components that are needed and concatenating the results.
3236 If a time unit in absent, it falls back to the next smallest
3237 unit.
3239 The keys :require-years, :require-months, :require-days,
3240 :require-weeks, :require-hours, :require-minutes are also
3241 meaningful. A non-nil value for these keys indicates that the
3242 corresponding time component should always be included, even if
3243 its value is 0.
3246 For example,
3248 (:days \"%dd\" :hours \"%d\" :require-hours t :minutes \":%02d\"
3249 :require-minutes t)
3251 means durations longer than a day will be expressed in days,
3252 hours and minutes, and durations less than a day will always be
3253 expressed in hours and minutes (even for durations less than an
3254 hour).
3256 The value
3258 (:days \"%dd\" :minutes \"%dm\")
3260 means durations longer than a day will be expressed in days and
3261 minutes, and durations less than a day will be expressed entirely
3262 in minutes (even for durations longer than an hour)."
3263 :group 'org-time
3264 :group 'org-clock
3265 :version "24.4"
3266 :package-version '(Org . "8.0")
3267 :type '(choice (string :tag "Format string")
3268 (set :tag "Plist"
3269 (group :inline t (const :tag "Years" :years)
3270 (string :tag "Format string"))
3271 (group :inline t
3272 (const :tag "Always show years" :require-years)
3273 (const t))
3274 (group :inline t (const :tag "Months" :months)
3275 (string :tag "Format string"))
3276 (group :inline t
3277 (const :tag "Always show months" :require-months)
3278 (const t))
3279 (group :inline t (const :tag "Weeks" :weeks)
3280 (string :tag "Format string"))
3281 (group :inline t
3282 (const :tag "Always show weeks" :require-weeks)
3283 (const t))
3284 (group :inline t (const :tag "Days" :days)
3285 (string :tag "Format string"))
3286 (group :inline t
3287 (const :tag "Always show days" :require-days)
3288 (const t))
3289 (group :inline t (const :tag "Hours" :hours)
3290 (string :tag "Format string"))
3291 (group :inline t
3292 (const :tag "Always show hours" :require-hours)
3293 (const t))
3294 (group :inline t (const :tag "Minutes" :minutes)
3295 (string :tag "Format string"))
3296 (group :inline t
3297 (const :tag "Always show minutes" :require-minutes)
3298 (const t)))))
3300 (defcustom org-time-clocksum-use-fractional nil
3301 "When non-nil, \\[org-clock-display] uses fractional times.
3302 See `org-time-clocksum-format' for more on time clock formats."
3303 :group 'org-time
3304 :group 'org-clock
3305 :version "24.3"
3306 :type 'boolean)
3308 (defcustom org-time-clocksum-use-effort-durations nil
3309 "When non-nil, \\[org-clock-display] uses effort durations.
3310 E.g. by default, one day is considered to be a 8 hours effort,
3311 so a task that has been clocked for 16 hours will be displayed
3312 as during 2 days in the clock display or in the clocktable.
3314 See `org-effort-durations' on how to set effort durations
3315 and `org-time-clocksum-format' for more on time clock formats."
3316 :group 'org-time
3317 :group 'org-clock
3318 :version "24.4"
3319 :package-version '(Org . "8.0")
3320 :type 'boolean)
3322 (defcustom org-time-clocksum-fractional-format "%.2f"
3323 "The format string used when creating CLOCKSUM lines,
3324 or when Org mode generates a time duration, if
3325 `org-time-clocksum-use-fractional' is enabled.
3327 The value can be a single format string containing one
3328 %-sequence, which will be filled with the number of hours as
3329 a float.
3331 Alternatively, the value can be a plist associating any of the
3332 keys :years, :months, :weeks, :days, :hours or :minutes with
3333 a format string. The time duration is formatted using the
3334 largest time unit which gives a non-zero integer part. If all
3335 specified formats have zero integer part, the smallest time unit
3336 is used."
3337 :group 'org-time
3338 :type '(choice (string :tag "Format string")
3339 (set (group :inline t (const :tag "Years" :years)
3340 (string :tag "Format string"))
3341 (group :inline t (const :tag "Months" :months)
3342 (string :tag "Format string"))
3343 (group :inline t (const :tag "Weeks" :weeks)
3344 (string :tag "Format string"))
3345 (group :inline t (const :tag "Days" :days)
3346 (string :tag "Format string"))
3347 (group :inline t (const :tag "Hours" :hours)
3348 (string :tag "Format string"))
3349 (group :inline t (const :tag "Minutes" :minutes)
3350 (string :tag "Format string")))))
3352 (defcustom org-deadline-warning-days 14
3353 "Number of days before expiration during which a deadline becomes active.
3354 This variable governs the display in sparse trees and in the agenda.
3355 When 0 or negative, it means use this number (the absolute value of it)
3356 even if a deadline has a different individual lead time specified.
3358 Custom commands can set this variable in the options section."
3359 :group 'org-time
3360 :group 'org-agenda-daily/weekly
3361 :type 'integer)
3363 (defcustom org-scheduled-delay-days 0
3364 "Number of days before a scheduled item becomes active.
3365 This variable governs the display in sparse trees and in the agenda.
3366 The default value (i.e. 0) means: don't delay scheduled item.
3367 When negative, it means use this number (the absolute value of it)
3368 even if a scheduled item has a different individual delay time
3369 specified.
3371 Custom commands can set this variable in the options section."
3372 :group 'org-time
3373 :group 'org-agenda-daily/weekly
3374 :version "24.4"
3375 :package-version '(Org . "8.0")
3376 :type 'integer)
3378 (defcustom org-read-date-prefer-future t
3379 "Non-nil means assume future for incomplete date input from user.
3380 This affects the following situations:
3381 1. The user gives a month but not a year.
3382 For example, if it is April and you enter \"feb 2\", this will be read
3383 as Feb 2, *next* year. \"May 5\", however, will be this year.
3384 2. The user gives a day, but no month.
3385 For example, if today is the 15th, and you enter \"3\", Org will read
3386 this as the third of *next* month. However, if you enter \"17\",
3387 it will be considered as *this* month.
3389 If you set this variable to the symbol `time', then also the following
3390 will work:
3392 3. If the user gives a time.
3393 If the time is before now, it will be interpreted as tomorrow.
3395 Currently none of this works for ISO week specifications.
3397 When this option is nil, the current day, month and year will always be
3398 used as defaults.
3400 See also `org-agenda-jump-prefer-future'."
3401 :group 'org-time
3402 :type '(choice
3403 (const :tag "Never" nil)
3404 (const :tag "Check month and day" t)
3405 (const :tag "Check month, day, and time" time)))
3407 (defcustom org-agenda-jump-prefer-future 'org-read-date-prefer-future
3408 "Should the agenda jump command prefer the future for incomplete dates?
3409 The default is to do the same as configured in `org-read-date-prefer-future'.
3410 But you can also set a deviating value here.
3411 This may t or nil, or the symbol `org-read-date-prefer-future'."
3412 :group 'org-agenda
3413 :group 'org-time
3414 :version "24.1"
3415 :type '(choice
3416 (const :tag "Use org-read-date-prefer-future"
3417 org-read-date-prefer-future)
3418 (const :tag "Never" nil)
3419 (const :tag "Always" t)))
3421 (defcustom org-read-date-force-compatible-dates t
3422 "Should date/time prompt force dates that are guaranteed to work in Emacs?
3424 Depending on the system Emacs is running on, certain dates cannot
3425 be represented with the type used internally to represent time.
3426 Dates between 1970-1-1 and 2038-1-1 can always be represented
3427 correctly. Some systems allow for earlier dates, some for later,
3428 some for both. One way to find out it to insert any date into an
3429 Org buffer, putting the cursor on the year and hitting S-up and
3430 S-down to test the range.
3432 When this variable is set to t, the date/time prompt will not let
3433 you specify dates outside the 1970-2037 range, so it is certain that
3434 these dates will work in whatever version of Emacs you are
3435 running, and also that you can move a file from one Emacs implementation
3436 to another. WHenever Org is forcing the year for you, it will display
3437 a message and beep.
3439 When this variable is nil, Org will check if the date is
3440 representable in the specific Emacs implementation you are using.
3441 If not, it will force a year, usually the current year, and beep
3442 to remind you. Currently this setting is not recommended because
3443 the likelihood that you will open your Org files in an Emacs that
3444 has limited date range is not negligible.
3446 A workaround for this problem is to use diary sexp dates for time
3447 stamps outside of this range."
3448 :group 'org-time
3449 :version "24.1"
3450 :type 'boolean)
3452 (defcustom org-read-date-display-live t
3453 "Non-nil means display current interpretation of date prompt live.
3454 This display will be in an overlay, in the minibuffer."
3455 :group 'org-time
3456 :type 'boolean)
3458 (defcustom org-read-date-popup-calendar t
3459 "Non-nil means pop up a calendar when prompting for a date.
3460 In the calendar, the date can be selected with mouse-1. However, the
3461 minibuffer will also be active, and you can simply enter the date as well.
3462 When nil, only the minibuffer will be available."
3463 :group 'org-time
3464 :type 'boolean)
3465 (defvaralias 'org-popup-calendar-for-date-prompt
3466 'org-read-date-popup-calendar)
3468 (defcustom org-extend-today-until 0
3469 "The hour when your day really ends. Must be an integer.
3470 This has influence for the following applications:
3471 - When switching the agenda to \"today\". It it is still earlier than
3472 the time given here, the day recognized as TODAY is actually yesterday.
3473 - When a date is read from the user and it is still before the time given
3474 here, the current date and time will be assumed to be yesterday, 23:59.
3475 Also, timestamps inserted in capture templates follow this rule.
3477 IMPORTANT: This is a feature whose implementation is and likely will
3478 remain incomplete. Really, it is only here because past midnight seems to
3479 be the favorite working time of John Wiegley :-)"
3480 :group 'org-time
3481 :type 'integer)
3483 (defcustom org-use-effective-time nil
3484 "If non-nil, consider `org-extend-today-until' when creating timestamps.
3485 For example, if `org-extend-today-until' is 8, and it's 4am, then the
3486 \"effective time\" of any timestamps between midnight and 8am will be
3487 23:59 of the previous day."
3488 :group 'org-time
3489 :version "24.1"
3490 :type 'boolean)
3492 (defcustom org-use-last-clock-out-time-as-effective-time nil
3493 "When non-nil, use the last clock out time for `org-todo'.
3494 Note that this option has precedence over the combined use of
3495 `org-use-effective-time' and `org-extend-today-until'."
3496 :group 'org-time
3497 :version "24.4"
3498 :package-version '(Org . "8.0")
3499 :type 'boolean)
3501 (defcustom org-edit-timestamp-down-means-later nil
3502 "Non-nil means S-down will increase the time in a time stamp.
3503 When nil, S-up will increase."
3504 :group 'org-time
3505 :type 'boolean)
3507 (defcustom org-calendar-follow-timestamp-change t
3508 "Non-nil means make the calendar window follow timestamp changes.
3509 When a timestamp is modified and the calendar window is visible, it will be
3510 moved to the new date."
3511 :group 'org-time
3512 :type 'boolean)
3514 (defgroup org-tags nil
3515 "Options concerning tags in Org-mode."
3516 :tag "Org Tags"
3517 :group 'org)
3519 (defcustom org-tag-alist nil
3520 "Default tags available in Org files.
3522 The value of this variable is an alist. Associations either:
3524 (TAG)
3525 (TAG . SELECT)
3526 (SPECIAL)
3528 where TAG is a tag as a string, SELECT is a character, used to
3529 select that tag through the fast tag selection interface, and
3530 SPECIAL is one of the following keywords: `:startgroup',
3531 `:startgrouptag', `:grouptags', `:engroup', `:endgrouptag' or
3532 `:newline'. These keywords are used to define a hierarchy of
3533 tags. See manual for details.
3535 When this variable is nil, Org mode bases tag input on what is
3536 already in the buffer. The value can be overridden locally by
3537 using a TAGS keyword, e.g.,
3539 #+TAGS: tag1 tag2
3541 See also `org-tag-persistent-alist' to sidestep this behavior."
3542 :group 'org-tags
3543 :type '(repeat
3544 (choice
3545 (cons (string :tag "Tag name")
3546 (character :tag "Access char"))
3547 (const :tag "Start radio group" (:startgroup))
3548 (const :tag "Start tag group, non distinct" (:startgrouptag))
3549 (const :tag "Group tags delimiter" (:grouptags))
3550 (const :tag "End radio group" (:endgroup))
3551 (const :tag "End tag group, non distinct" (:endgrouptag))
3552 (const :tag "New line" (:newline)))))
3554 (defcustom org-tag-persistent-alist nil
3555 "Tags always available in Org files.
3557 The value of this variable is an alist. Associations either:
3559 (TAG)
3560 (TAG . SELECT)
3561 (SPECIAL)
3563 where TAG is a tag as a string, SELECT is a character, used to
3564 select that tag through the fast tag selection interface, and
3565 SPECIAL is one of the following keywords: `:startgroup',
3566 `:startgrouptag', `:grouptags', `:engroup', `:endgrouptag' or
3567 `:newline'. These keywords are used to define a hierarchy of
3568 tags. See manual for details.
3570 Unlike to `org-tag-alist', tags defined in this variable do not
3571 depend on a local TAGS keyword. Instead, to disable these tags
3572 on a per-file basis, insert anywhere in the file:
3574 #+STARTUP: noptag"
3575 :group 'org-tags
3576 :type '(repeat
3577 (choice
3578 (cons (string :tag "Tag name")
3579 (character :tag "Access char"))
3580 (const :tag "Start radio group" (:startgroup))
3581 (const :tag "Start tag group, non distinct" (:startgrouptag))
3582 (const :tag "Group tags delimiter" (:grouptags))
3583 (const :tag "End radio group" (:endgroup))
3584 (const :tag "End tag group, non distinct" (:endgrouptag))
3585 (const :tag "New line" (:newline)))))
3587 (defcustom org-complete-tags-always-offer-all-agenda-tags nil
3588 "If non-nil, always offer completion for all tags of all agenda files.
3589 Instead of customizing this variable directly, you might want to
3590 set it locally for capture buffers, because there no list of
3591 tags in that file can be created dynamically (there are none).
3593 (add-hook \\='org-capture-mode-hook
3594 (lambda ()
3595 (setq-local org-complete-tags-always-offer-all-agenda-tags t)))"
3596 :group 'org-tags
3597 :version "24.1"
3598 :type 'boolean)
3600 (defvar org-file-tags nil
3601 "List of tags that can be inherited by all entries in the file.
3602 The tags will be inherited if the variable `org-use-tag-inheritance'
3603 says they should be.
3604 This variable is populated from #+FILETAGS lines.")
3606 (defcustom org-use-fast-tag-selection 'auto
3607 "Non-nil means use fast tag selection scheme.
3608 This is a special interface to select and deselect tags with single keys.
3609 When nil, fast selection is never used.
3610 When the symbol `auto', fast selection is used if and only if selection
3611 characters for tags have been configured, either through the variable
3612 `org-tag-alist' or through a #+TAGS line in the buffer.
3613 When t, fast selection is always used and selection keys are assigned
3614 automatically if necessary."
3615 :group 'org-tags
3616 :type '(choice
3617 (const :tag "Always" t)
3618 (const :tag "Never" nil)
3619 (const :tag "When selection characters are configured" auto)))
3621 (defcustom org-fast-tag-selection-single-key nil
3622 "Non-nil means fast tag selection exits after first change.
3623 When nil, you have to press RET to exit it.
3624 During fast tag selection, you can toggle this flag with `C-c'.
3625 This variable can also have the value `expert'. In this case, the window
3626 displaying the tags menu is not even shown, until you press C-c again."
3627 :group 'org-tags
3628 :type '(choice
3629 (const :tag "No" nil)
3630 (const :tag "Yes" t)
3631 (const :tag "Expert" expert)))
3633 (defvar org-fast-tag-selection-include-todo nil
3634 "Non-nil means fast tags selection interface will also offer TODO states.
3635 This is an undocumented feature, you should not rely on it.")
3637 (defcustom org-tags-column -77
3638 "The column to which tags should be indented in a headline.
3639 If this number is positive, it specifies the column. If it is negative,
3640 it means that the tags should be flushright to that column. For example,
3641 -80 works well for a normal 80 character screen.
3642 When 0, place tags directly after headline text, with only one space in
3643 between."
3644 :group 'org-tags
3645 :type 'integer)
3647 (defcustom org-auto-align-tags t
3648 "Non-nil keeps tags aligned when modifying headlines.
3649 Some operations (i.e. demoting) change the length of a headline and
3650 therefore shift the tags around. With this option turned on, after
3651 each such operation the tags are again aligned to `org-tags-column'."
3652 :group 'org-tags
3653 :type 'boolean)
3655 (defcustom org-use-tag-inheritance t
3656 "Non-nil means tags in levels apply also for sublevels.
3657 When nil, only the tags directly given in a specific line apply there.
3658 This may also be a list of tags that should be inherited, or a regexp that
3659 matches tags that should be inherited. Additional control is possible
3660 with the variable `org-tags-exclude-from-inheritance' which gives an
3661 explicit list of tags to be excluded from inheritance, even if the value of
3662 `org-use-tag-inheritance' would select it for inheritance.
3664 If this option is t, a match early-on in a tree can lead to a large
3665 number of matches in the subtree when constructing the agenda or creating
3666 a sparse tree. If you only want to see the first match in a tree during
3667 a search, check out the variable `org-tags-match-list-sublevels'."
3668 :group 'org-tags
3669 :type '(choice
3670 (const :tag "Not" nil)
3671 (const :tag "Always" t)
3672 (repeat :tag "Specific tags" (string :tag "Tag"))
3673 (regexp :tag "Tags matched by regexp")))
3675 (defcustom org-tags-exclude-from-inheritance nil
3676 "List of tags that should never be inherited.
3677 This is a way to exclude a few tags from inheritance. For way to do
3678 the opposite, to actively allow inheritance for selected tags,
3679 see the variable `org-use-tag-inheritance'."
3680 :group 'org-tags
3681 :type '(repeat (string :tag "Tag")))
3683 (defun org-tag-inherit-p (tag)
3684 "Check if TAG is one that should be inherited."
3685 (cond
3686 ((member tag org-tags-exclude-from-inheritance) nil)
3687 ((eq org-use-tag-inheritance t) t)
3688 ((not org-use-tag-inheritance) nil)
3689 ((stringp org-use-tag-inheritance)
3690 (string-match org-use-tag-inheritance tag))
3691 ((listp org-use-tag-inheritance)
3692 (member tag org-use-tag-inheritance))
3693 (t (error "Invalid setting of `org-use-tag-inheritance'"))))
3695 (defcustom org-tags-match-list-sublevels t
3696 "Non-nil means list also sublevels of headlines matching a search.
3697 This variable applies to tags/property searches, and also to stuck
3698 projects because this search is based on a tags match as well.
3700 When set to the symbol `indented', sublevels are indented with
3701 leading dots.
3703 Because of tag inheritance (see variable `org-use-tag-inheritance'),
3704 the sublevels of a headline matching a tag search often also match
3705 the same search. Listing all of them can create very long lists.
3706 Setting this variable to nil causes subtrees of a match to be skipped.
3708 This variable is semi-obsolete and probably should always be true. It
3709 is better to limit inheritance to certain tags using the variables
3710 `org-use-tag-inheritance' and `org-tags-exclude-from-inheritance'."
3711 :group 'org-tags
3712 :type '(choice
3713 (const :tag "No, don't list them" nil)
3714 (const :tag "Yes, do list them" t)
3715 (const :tag "List them, indented with leading dots" indented)))
3717 (defcustom org-tags-sort-function nil
3718 "When set, tags are sorted using this function as a comparator."
3719 :group 'org-tags
3720 :type '(choice
3721 (const :tag "No sorting" nil)
3722 (const :tag "Alphabetical" string<)
3723 (const :tag "Reverse alphabetical" string>)
3724 (function :tag "Custom function" nil)))
3726 (defvar org-tags-history nil
3727 "History of minibuffer reads for tags.")
3728 (defvar org-last-tags-completion-table nil
3729 "The last used completion table for tags.")
3730 (defvar org-after-tags-change-hook nil
3731 "Hook that is run after the tags in a line have changed.")
3733 (defgroup org-properties nil
3734 "Options concerning properties in Org-mode."
3735 :tag "Org Properties"
3736 :group 'org)
3738 (defcustom org-property-format "%-10s %s"
3739 "How property key/value pairs should be formatted by `indent-line'.
3740 When `indent-line' hits a property definition, it will format the line
3741 according to this format, mainly to make sure that the values are
3742 lined-up with respect to each other."
3743 :group 'org-properties
3744 :type 'string)
3746 (defcustom org-properties-postprocess-alist nil
3747 "Alist of properties and functions to adjust inserted values.
3748 Elements of this alist must be of the form
3750 ([string] [function])
3752 where [string] must be a property name and [function] must be a
3753 lambda expression: this lambda expression must take one argument,
3754 the value to adjust, and return the new value as a string.
3756 For example, this element will allow the property \"Remaining\"
3757 to be updated wrt the relation between the \"Effort\" property
3758 and the clock summary:
3760 ((\"Remaining\" (lambda(value)
3761 (let ((clocksum (org-clock-sum-current-item))
3762 (effort (org-duration-string-to-minutes
3763 (org-entry-get (point) \"Effort\"))))
3764 (org-minutes-to-clocksum-string (- effort clocksum))))))"
3765 :group 'org-properties
3766 :version "24.1"
3767 :type '(alist :key-type (string :tag "Property")
3768 :value-type (function :tag "Function")))
3770 (defcustom org-use-property-inheritance nil
3771 "Non-nil means properties apply also for sublevels.
3773 This setting is chiefly used during property searches. Turning it on can
3774 cause significant overhead when doing a search, which is why it is not
3775 on by default.
3777 When nil, only the properties directly given in the current entry count.
3778 When t, every property is inherited. The value may also be a list of
3779 properties that should have inheritance, or a regular expression matching
3780 properties that should be inherited.
3782 However, note that some special properties use inheritance under special
3783 circumstances (not in searches). Examples are CATEGORY, ARCHIVE, COLUMNS,
3784 and the properties ending in \"_ALL\" when they are used as descriptor
3785 for valid values of a property.
3787 Note for programmers:
3788 When querying an entry with `org-entry-get', you can control if inheritance
3789 should be used. By default, `org-entry-get' looks only at the local
3790 properties. You can request inheritance by setting the inherit argument
3791 to t (to force inheritance) or to `selective' (to respect the setting
3792 in this variable)."
3793 :group 'org-properties
3794 :type '(choice
3795 (const :tag "Not" nil)
3796 (const :tag "Always" t)
3797 (repeat :tag "Specific properties" (string :tag "Property"))
3798 (regexp :tag "Properties matched by regexp")))
3800 (defun org-property-inherit-p (property)
3801 "Check if PROPERTY is one that should be inherited."
3802 (cond
3803 ((eq org-use-property-inheritance t) t)
3804 ((not org-use-property-inheritance) nil)
3805 ((stringp org-use-property-inheritance)
3806 (string-match org-use-property-inheritance property))
3807 ((listp org-use-property-inheritance)
3808 (member property org-use-property-inheritance))
3809 (t (error "Invalid setting of `org-use-property-inheritance'"))))
3811 (defcustom org-columns-default-format "%25ITEM %TODO %3PRIORITY %TAGS"
3812 "The default column format, if no other format has been defined.
3813 This variable can be set on the per-file basis by inserting a line
3815 #+COLUMNS: %25ITEM ....."
3816 :group 'org-properties
3817 :type 'string)
3819 (defcustom org-columns-ellipses ".."
3820 "The ellipses to be used when a field in column view is truncated.
3821 When this is the empty string, as many characters as possible are shown,
3822 but then there will be no visual indication that the field has been truncated.
3823 When this is a string of length N, the last N characters of a truncated
3824 field are replaced by this string. If the column is narrower than the
3825 ellipses string, only part of the ellipses string will be shown."
3826 :group 'org-properties
3827 :type 'string)
3829 (defconst org-global-properties-fixed
3830 '(("VISIBILITY_ALL" . "folded children content all")
3831 ("CLOCK_MODELINE_TOTAL_ALL" . "current today repeat all auto"))
3832 "List of property/value pairs that can be inherited by any entry.
3834 These are fixed values, for the preset properties. The user variable
3835 that can be used to add to this list is `org-global-properties'.
3837 The entries in this list are cons cells where the car is a property
3838 name and cdr is a string with the value. If the value represents
3839 multiple items like an \"_ALL\" property, separate the items by
3840 spaces.")
3842 (defcustom org-global-properties nil
3843 "List of property/value pairs that can be inherited by any entry.
3845 This list will be combined with the constant `org-global-properties-fixed'.
3847 The entries in this list are cons cells where the car is a property
3848 name and cdr is a string with the value.
3850 You can set buffer-local values for the same purpose in the variable
3851 `org-file-properties' this by adding lines like
3854 :group 'org-properties
3855 :type '(repeat
3856 (cons (string :tag "Property")
3857 (string :tag "Value"))))
3859 (defvar-local org-file-properties nil
3860 "List of property/value pairs that can be inherited by any entry.
3861 Valid for the current buffer.
3862 This variable is populated from #+PROPERTY lines.")
3864 (defgroup org-agenda nil
3865 "Options concerning agenda views in Org-mode."
3866 :tag "Org Agenda"
3867 :group 'org)
3869 (defvar-local org-category nil
3870 "Variable used by org files to set a category for agenda display.
3871 Such files should use a file variable to set it, for example
3873 # -*- mode: org; org-category: \"ELisp\"
3875 or contain a special line
3877 #+CATEGORY: ELisp
3879 If the file does not specify a category, then file's base name
3880 is used instead.")
3881 (put 'org-category 'safe-local-variable (lambda (x) (or (symbolp x) (stringp x))))
3883 (defcustom org-agenda-files nil
3884 "The files to be used for agenda display.
3885 Entries may be added to this list with \\[org-agenda-file-to-front] and removed with
3886 \\[org-remove-file]. You can also use customize to edit the list.
3888 If an entry is a directory, all files in that directory that are matched by
3889 `org-agenda-file-regexp' will be part of the file list.
3891 If the value of the variable is not a list but a single file name, then
3892 the list of agenda files is actually stored and maintained in that file, one
3893 agenda file per line. In this file paths can be given relative to
3894 `org-directory'. Tilde expansion and environment variable substitution
3895 are also made."
3896 :group 'org-agenda
3897 :type '(choice
3898 (repeat :tag "List of files and directories" file)
3899 (file :tag "Store list in a file\n" :value "~/.agenda_files")))
3901 (defcustom org-agenda-file-regexp "\\`[^.].*\\.org\\'"
3902 "Regular expression to match files for `org-agenda-files'.
3903 If any element in the list in that variable contains a directory instead
3904 of a normal file, all files in that directory that are matched by this
3905 regular expression will be included."
3906 :group 'org-agenda
3907 :type 'regexp)
3909 (defcustom org-agenda-text-search-extra-files nil
3910 "List of extra files to be searched by text search commands.
3911 These files will be searched in addition to the agenda files by the
3912 commands `org-search-view' (`\\[org-agenda] s') \
3913 and `org-occur-in-agenda-files'.
3914 Note that these files will only be searched for text search commands,
3915 not for the other agenda views like todo lists, tag searches or the weekly
3916 agenda. This variable is intended to list notes and possibly archive files
3917 that should also be searched by these two commands.
3918 In fact, if the first element in the list is the symbol `agenda-archives',
3919 then all archive files of all agenda files will be added to the search
3920 scope."
3921 :group 'org-agenda
3922 :type '(set :greedy t
3923 (const :tag "Agenda Archives" agenda-archives)
3924 (repeat :inline t (file))))
3926 (defvaralias 'org-agenda-multi-occur-extra-files
3927 'org-agenda-text-search-extra-files)
3929 (defcustom org-agenda-skip-unavailable-files nil
3930 "Non-nil means to just skip non-reachable files in `org-agenda-files'.
3931 A nil value means to remove them, after a query, from the list."
3932 :group 'org-agenda
3933 :type 'boolean)
3935 (defcustom org-calendar-to-agenda-key [?c]
3936 "The key to be installed in `calendar-mode-map' for switching to the agenda.
3937 The command `org-calendar-goto-agenda' will be bound to this key. The
3938 default is the character `c' because then `c' can be used to switch back and
3939 forth between agenda and calendar."
3940 :group 'org-agenda
3941 :type 'sexp)
3943 (defcustom org-calendar-insert-diary-entry-key [?i]
3944 "The key to be installed in `calendar-mode-map' for adding diary entries.
3945 This option is irrelevant until `org-agenda-diary-file' has been configured
3946 to point to an Org file. When that is the case, the command
3947 `org-agenda-diary-entry' will be bound to the key given here, by default
3948 `i'. In the calendar, `i' normally adds entries to `diary-file'. So
3949 if you want to continue doing this, you need to change this to a different
3950 key."
3951 :group 'org-agenda
3952 :type 'sexp)
3954 (defcustom org-agenda-diary-file 'diary-file
3955 "File to which to add new entries with the `i' key in agenda and calendar.
3956 When this is the symbol `diary-file', the functionality in the Emacs
3957 calendar will be used to add entries to the `diary-file'. But when this
3958 points to a file, `org-agenda-diary-entry' will be used instead."
3959 :group 'org-agenda
3960 :type '(choice
3961 (const :tag "The standard Emacs diary file" diary-file)
3962 (file :tag "Special Org file diary entries")))
3964 (eval-after-load "calendar"
3965 '(progn
3966 (org-defkey calendar-mode-map org-calendar-to-agenda-key
3967 'org-calendar-goto-agenda)
3968 (add-hook 'calendar-mode-hook
3969 (lambda ()
3970 (unless (eq org-agenda-diary-file 'diary-file)
3971 (define-key calendar-mode-map
3972 org-calendar-insert-diary-entry-key
3973 'org-agenda-diary-entry))))))
3975 (defgroup org-latex nil
3976 "Options for embedding LaTeX code into Org-mode."
3977 :tag "Org LaTeX"
3978 :group 'org)
3980 (defcustom org-format-latex-options
3981 '(:foreground default :background default :scale 1.0
3982 :html-foreground "Black" :html-background "Transparent"
3983 :html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))
3984 "Options for creating images from LaTeX fragments.
3985 This is a property list with the following properties:
3986 :foreground the foreground color for images embedded in Emacs, e.g. \"Black\".
3987 `default' means use the foreground of the default face.
3988 `auto' means use the foreground from the text face.
3989 :background the background color, or \"Transparent\".
3990 `default' means use the background of the default face.
3991 `auto' means use the background from the text face.
3992 :scale a scaling factor for the size of the images, to get more pixels
3993 :html-foreground, :html-background, :html-scale
3994 the same numbers for HTML export.
3995 :matchers a list indicating which matchers should be used to
3996 find LaTeX fragments. Valid members of this list are:
3997 \"begin\" find environments
3998 \"$1\" find single characters surrounded by $.$
3999 \"$\" find math expressions surrounded by $...$
4000 \"$$\" find math expressions surrounded by $$....$$
4001 \"\\(\" find math expressions surrounded by \\(...\\)
4002 \"\\=\\[\" find math expressions surrounded by \\=\\[...\\]"
4003 :group 'org-latex
4004 :type 'plist)
4006 (defcustom org-format-latex-signal-error t
4007 "Non-nil means signal an error when image creation of LaTeX snippets fails.
4008 When nil, just push out a message."
4009 :group 'org-latex
4010 :version "24.1"
4011 :type 'boolean)
4013 (defcustom org-latex-to-mathml-jar-file nil
4014 "Value of\"%j\" in `org-latex-to-mathml-convert-command'.
4015 Use this to specify additional executable file say a jar file.
4017 When using MathToWeb as the converter, specify the full-path to
4018 your mathtoweb.jar file."
4019 :group 'org-latex
4020 :version "24.1"
4021 :type '(choice
4022 (const :tag "None" nil)
4023 (file :tag "JAR file" :must-match t)))
4025 (defcustom org-latex-to-mathml-convert-command nil
4026 "Command to convert LaTeX fragments to MathML.
4027 Replace format-specifiers in the command as noted below and use
4028 `shell-command' to convert LaTeX to MathML.
4029 %j: Executable file in fully expanded form as specified by
4030 `org-latex-to-mathml-jar-file'.
4031 %I: Input LaTeX file in fully expanded form.
4032 %i: The latex fragment to be converted.
4033 %o: Output MathML file.
4035 This command is used by `org-create-math-formula'.
4037 When using MathToWeb as the converter, set this option to
4038 \"java -jar %j -unicode -force -df %o %I\".
4040 When using LaTeXML set this option to
4041 \"latexmlmath \"%i\" --presentationmathml=%o\"."
4042 :group 'org-latex
4043 :version "24.1"
4044 :type '(choice
4045 (const :tag "None" nil)
4046 (string :tag "\nShell command")))
4048 (defcustom org-preview-latex-default-process 'dvipng
4049 "The default process to convert LaTeX fragments to image files.
4050 All available processes and theirs documents can be found in
4051 `org-preview-latex-process-alist', which see."
4052 :group 'org-latex
4053 :version "25.2"
4054 :package-version '(Org . "9.0")
4055 :type 'symbol)
4057 (defcustom org-preview-latex-process-alist
4058 '((dvipng
4059 :programs ("latex" "dvipng" "gs")
4060 :description "dvi > png"
4061 :message "you need to install the programs: latex, dvipng and ghostscript."
4062 :image-input-type "dvi"
4063 :image-output-type "png"
4064 :image-size-adjust (1.0 . 1.0)
4065 :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
4066 :image-converter ("dvipng -fg %F -bg %B -D %D -T tight -o %b.png %f"))
4067 (dvisvgm
4068 :programs ("latex" "dvisvgm" "gs")
4069 :description "dvi > svg"
4070 :message "you need to install the programs: latex, dvisvgm and ghostscript."
4071 :use-xcolor t
4072 :image-input-type "dvi"
4073 :image-output-type "svg"
4074 :image-size-adjust (1.7 . 1.5)
4075 :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
4076 :image-converter ("dvisvgm %f -n -b min -c %S -o %b.svg"))
4077 (imagemagick
4078 :programs ("latex" "convert" "gs")
4079 :description "pdf > png"
4080 :message
4081 "you need to install the programs: latex, imagemagick and ghostscript."
4082 :use-xcolor t
4083 :image-input-type "pdf"
4084 :image-output-type "png"
4085 :image-size-adjust (1.0 . 1.0)
4086 :latex-compiler ("pdflatex -interaction nonstopmode -output-directory %o %f")
4087 :image-converter
4088 ("convert -density %D -trim -antialias %f -quality 100 %b.png")))
4089 "Definitions of external processes for LaTeX previewing.
4090 Org mode can use some external commands to generate TeX snippet's images for
4091 previewing or inserting into HTML files, e.g., \"dvipng\". This variable tells
4092 `org-create-formula-image' how to call them.
4094 The value is an alist with the pattern (NAME . PROPERTIES). NAME is a symbol.
4095 PROPERTIES accepts the following attributes:
4097 :programs list of strings, required programs.
4098 :description string, describe the process.
4099 :message string, message it when required programs cannot be found.
4100 :image-input-type string, input file type of image converter (e.g., \"dvi\").
4101 :image-output-type string, output file type of image converter (e.g., \"png\").
4102 :use-xcolor boolean, when non-nil, LaTeX \"xcolor\" macro is used to
4103 deal with background and foreground color of image.
4104 Otherwise, dvipng style background and foregroud color
4105 format are generated. You may then refer to them in
4106 command options with \"%F\" and \"%B\".
4107 :image-size-adjust cons of numbers, the car element is used to adjust LaTeX
4108 image size showed in buffer and the cdr element is for
4109 HTML file. This option is only useful for process
4110 developers, users should use variable
4111 `org-format-latex-options' instead.
4112 :post-clean list of strings, files matched are to be cleaned up once
4113 the image is generated. When nil, the files with \".dvi\",
4114 \".xdv\", \".pdf\", \".tex\", \".aux\", \".log\", \".svg\",
4115 \".png\", \".jpg\", \".jpeg\" or \".out\" extension will
4116 be cleaned up.
4117 :latex-header list of strings, the LaTeX header of the snippet file.
4118 When nil, the fallback value is used instead, which is
4119 controlled by `org-format-latex-header',
4120 `org-latex-default-packages-alist' and
4121 `org-latex-packages-alist', which see.
4122 :latex-compiler list of LaTeX commands, as strings. Each of them is given
4123 to the shell. Place-holders \"%t\", \"%b\" and \"%o\" are
4124 replaced with values defined below.
4125 :image-converter list of image converter commands strings. Each of them is
4126 given to the shell and supports any of the following
4127 place-holders defined below.
4129 Place-holders used by `:image-converter' and `:latex-compiler':
4131 %f input file name.
4132 %b base name of input file.
4133 %o base directory of input file.
4135 Place-holders only used by `:image-converter':
4137 %F foreground of image
4138 %B background of image
4139 %D dpi, which is used to adjust image size by some processing commands.
4140 %S the image size scale ratio, which is used to adjust image size by some
4141 processing commands."
4142 :group 'org-latex
4143 :version "25.2"
4144 :package-version '(Org . "9.0")
4145 :type '(alist :tag "LaTeX to image backends"
4146 :value-type (plist)))
4148 (defcustom org-preview-latex-image-directory "ltximg/"
4149 "Path to store latex preview images.
4150 A relative path here creates many directories relative to the
4151 processed org files paths. An absolute path puts all preview
4152 images at the same place."
4153 :group 'org-latex
4154 :version "25.1"
4155 :package-version '(Org . "9.0")
4156 :type 'string)
4158 (defun org-format-latex-mathml-available-p ()
4159 "Return t if `org-latex-to-mathml-convert-command' is usable."
4160 (save-match-data
4161 (when (and (boundp 'org-latex-to-mathml-convert-command)
4162 org-latex-to-mathml-convert-command)
4163 (let ((executable (car (split-string
4164 org-latex-to-mathml-convert-command))))
4165 (when (executable-find executable)
4166 (if (string-match
4167 "%j" org-latex-to-mathml-convert-command)
4168 (file-readable-p org-latex-to-mathml-jar-file)
4169 t))))))
4171 (defcustom org-format-latex-header "\\documentclass{article}
4172 \\usepackage[usenames]{color}
4173 \[PACKAGES]
4175 \\pagestyle{empty} % do not remove
4176 % The settings below are copied from fullpage.sty
4177 \\setlength{\\textwidth}{\\paperwidth}
4178 \\addtolength{\\textwidth}{-3cm}
4179 \\setlength{\\oddsidemargin}{1.5cm}
4180 \\addtolength{\\oddsidemargin}{-2.54cm}
4181 \\setlength{\\evensidemargin}{\\oddsidemargin}
4182 \\setlength{\\textheight}{\\paperheight}
4183 \\addtolength{\\textheight}{-\\headheight}
4184 \\addtolength{\\textheight}{-\\headsep}
4185 \\addtolength{\\textheight}{-\\footskip}
4186 \\addtolength{\\textheight}{-3cm}
4187 \\setlength{\\topmargin}{1.5cm}
4188 \\addtolength{\\topmargin}{-2.54cm}"
4189 "The document header used for processing LaTeX fragments.
4190 It is imperative that this header make sure that no page number
4191 appears on the page. The package defined in the variables
4192 `org-latex-default-packages-alist' and `org-latex-packages-alist'
4193 will either replace the placeholder \"[PACKAGES]\" in this
4194 header, or they will be appended."
4195 :group 'org-latex
4196 :type 'string)
4198 (defun org-set-packages-alist (var val)
4199 "Set the packages alist and make sure it has 3 elements per entry."
4200 (set var (mapcar (lambda (x)
4201 (if (and (consp x) (= (length x) 2))
4202 (list (car x) (nth 1 x) t)
4204 val)))
4206 (defun org-get-packages-alist (var)
4207 "Get the packages alist and make sure it has 3 elements per entry."
4208 (mapcar (lambda (x)
4209 (if (and (consp x) (= (length x) 2))
4210 (list (car x) (nth 1 x) t)
4212 (default-value var)))
4214 (defcustom org-latex-default-packages-alist
4215 '(("AUTO" "inputenc" t ("pdflatex"))
4216 ("T1" "fontenc" t ("pdflatex"))
4217 ("" "graphicx" t)
4218 ("" "grffile" t)
4219 ("" "longtable" nil)
4220 ("" "wrapfig" nil)
4221 ("" "rotating" nil)
4222 ("normalem" "ulem" t)
4223 ("" "amsmath" t)
4224 ("" "textcomp" t)
4225 ("" "amssymb" t)
4226 ("" "capt-of" nil)
4227 ("" "hyperref" nil))
4228 "Alist of default packages to be inserted in the header.
4230 Change this only if one of the packages here causes an
4231 incompatibility with another package you are using.
4233 The packages in this list are needed by one part or another of
4234 Org mode to function properly:
4236 - inputenc, fontenc: for basic font and character selection
4237 - graphicx: for including images
4238 - grffile: allow periods and spaces in graphics file names
4239 - longtable: For multipage tables
4240 - wrapfig: for figure placement
4241 - rotating: for sideways figures and tables
4242 - ulem: for underline and strike-through
4243 - amsmath: for subscript and superscript and math environments
4244 - textcomp, amssymb: for various symbols used
4245 for interpreting the entities in `org-entities'. You can skip
4246 some of these packages if you don't use any of their symbols.
4247 - capt-of: for captions outside of floats
4248 - hyperref: for cross references
4250 Therefore you should not modify this variable unless you know
4251 what you are doing. The one reason to change it anyway is that
4252 you might be loading some other package that conflicts with one
4253 of the default packages. Each element is either a cell or
4254 a string.
4256 A cell is of the format
4258 (\"options\" \"package\" SNIPPET-FLAG COMPILERS)
4260 If SNIPPET-FLAG is non-nil, the package also needs to be included
4261 when compiling LaTeX snippets into images for inclusion into
4262 non-LaTeX output. COMPILERS is a list of compilers that should
4263 include the package, see `org-latex-compiler'. If the document
4264 compiler is not in the list, and the list is non-nil, the package
4265 will not be inserted in the final document.
4267 A string will be inserted as-is in the header of the document."
4268 :group 'org-latex
4269 :group 'org-export-latex
4270 :set 'org-set-packages-alist
4271 :get 'org-get-packages-alist
4272 :version "25.1"
4273 :package-version '(Org . "8.3")
4274 :type '(repeat
4275 (choice
4276 (list :tag "options/package pair"
4277 (string :tag "options")
4278 (string :tag "package")
4279 (boolean :tag "Snippet"))
4280 (string :tag "A line of LaTeX"))))
4282 (defcustom org-latex-packages-alist nil
4283 "Alist of packages to be inserted in every LaTeX header.
4285 These will be inserted after `org-latex-default-packages-alist'.
4286 Each element is either a cell or a string.
4288 A cell is of the format:
4290 (\"options\" \"package\" SNIPPET-FLAG)
4292 SNIPPET-FLAG, when non-nil, indicates that this package is also
4293 needed when turning LaTeX snippets into images for inclusion into
4294 non-LaTeX output.
4296 A string will be inserted as-is in the header of the document.
4298 Make sure that you only list packages here which:
4300 - you want in every file;
4301 - do not conflict with the setup in `org-format-latex-header';
4302 - do not conflict with the default packages in
4303 `org-latex-default-packages-alist'."
4304 :group 'org-latex
4305 :group 'org-export-latex
4306 :set 'org-set-packages-alist
4307 :get 'org-get-packages-alist
4308 :type '(repeat
4309 (choice
4310 (list :tag "options/package pair"
4311 (string :tag "options")
4312 (string :tag "package")
4313 (boolean :tag "Snippet"))
4314 (string :tag "A line of LaTeX"))))
4316 (defgroup org-appearance nil
4317 "Settings for Org mode appearance."
4318 :tag "Org Appearance"
4319 :group 'org)
4321 (defcustom org-level-color-stars-only nil
4322 "Non-nil means fontify only the stars in each headline.
4323 When nil, the entire headline is fontified.
4324 Changing it requires restart of `font-lock-mode' to become effective
4325 also in regions already fontified."
4326 :group 'org-appearance
4327 :type 'boolean)
4329 (defcustom org-hide-leading-stars nil
4330 "Non-nil means hide the first N-1 stars in a headline.
4331 This works by using the face `org-hide' for these stars. This
4332 face is white for a light background, and black for a dark
4333 background. You may have to customize the face `org-hide' to
4334 make this work.
4335 Changing it requires restart of `font-lock-mode' to become effective
4336 also in regions already fontified.
4337 You may also set this on a per-file basis by adding one of the following
4338 lines to the buffer:
4340 #+STARTUP: hidestars
4341 #+STARTUP: showstars"
4342 :group 'org-appearance
4343 :type 'boolean)
4345 (defcustom org-hidden-keywords nil
4346 "List of symbols corresponding to keywords to be hidden the org buffer.
4347 For example, a value \\='(title) for this list will make the document's title
4348 appear in the buffer without the initial #+TITLE: keyword."
4349 :group 'org-appearance
4350 :version "24.1"
4351 :type '(set (const :tag "#+AUTHOR" author)
4352 (const :tag "#+DATE" date)
4353 (const :tag "#+EMAIL" email)
4354 (const :tag "#+TITLE" title)))
4356 (defcustom org-custom-properties nil
4357 "List of properties (as strings) with a special meaning.
4358 The default use of these custom properties is to let the user
4359 hide them with `org-toggle-custom-properties-visibility'."
4360 :group 'org-properties
4361 :group 'org-appearance
4362 :version "24.3"
4363 :type '(repeat (string :tag "Property Name")))
4365 (defcustom org-fontify-done-headline nil
4366 "Non-nil means change the face of a headline if it is marked DONE.
4367 Normally, only the TODO/DONE keyword indicates the state of a headline.
4368 When this is non-nil, the headline after the keyword is set to the
4369 `org-headline-done' as an additional indication."
4370 :group 'org-appearance
4371 :type 'boolean)
4373 (defcustom org-fontify-emphasized-text t
4374 "Non-nil means fontify *bold*, /italic/ and _underlined_ text.
4375 Changing this variable requires a restart of Emacs to take effect."
4376 :group 'org-appearance
4377 :type 'boolean)
4379 (defcustom org-fontify-whole-heading-line nil
4380 "Non-nil means fontify the whole line for headings.
4381 This is useful when setting a background color for the
4382 org-level-* faces."
4383 :group 'org-appearance
4384 :type 'boolean)
4386 (defcustom org-highlight-latex-and-related nil
4387 "Non-nil means highlight LaTeX related syntax in the buffer.
4388 When non nil, the value should be a list containing any of the
4389 following symbols:
4390 `latex' Highlight LaTeX snippets and environments.
4391 `script' Highlight subscript and superscript.
4392 `entities' Highlight entities."
4393 :group 'org-appearance
4394 :version "24.4"
4395 :package-version '(Org . "8.0")
4396 :type '(choice
4397 (const :tag "No highlighting" nil)
4398 (set :greedy t :tag "Highlight"
4399 (const :tag "LaTeX snippets and environments" latex)
4400 (const :tag "Subscript and superscript" script)
4401 (const :tag "Entities" entities))))
4403 (defcustom org-hide-emphasis-markers nil
4404 "Non-nil mean font-lock should hide the emphasis marker characters."
4405 :group 'org-appearance
4406 :type 'boolean)
4408 (defcustom org-hide-macro-markers nil
4409 "Non-nil mean font-lock should hide the brackets marking macro calls."
4410 :group 'org-appearance
4411 :type 'boolean)
4413 (defcustom org-pretty-entities nil
4414 "Non-nil means show entities as UTF8 characters.
4415 When nil, the \\name form remains in the buffer."
4416 :group 'org-appearance
4417 :version "24.1"
4418 :type 'boolean)
4420 (defcustom org-pretty-entities-include-sub-superscripts t
4421 "Non-nil means, pretty entity display includes formatting sub/superscripts."
4422 :group 'org-appearance
4423 :version "24.1"
4424 :type 'boolean)
4426 (defvar org-emph-re nil
4427 "Regular expression for matching emphasis.
4428 After a match, the match groups contain these elements:
4429 0 The match of the full regular expression, including the characters
4430 before and after the proper match
4431 1 The character before the proper match, or empty at beginning of line
4432 2 The proper match, including the leading and trailing markers
4433 3 The leading marker like * or /, indicating the type of highlighting
4434 4 The text between the emphasis markers, not including the markers
4435 5 The character after the match, empty at the end of a line")
4436 (defvar org-verbatim-re nil
4437 "Regular expression for matching verbatim text.")
4438 (defvar org-emphasis-regexp-components) ; defined just below
4439 (defvar org-emphasis-alist) ; defined just below
4440 (defun org-set-emph-re (var val)
4441 "Set variable and compute the emphasis regular expression."
4442 (set var val)
4443 (when (and (boundp 'org-emphasis-alist)
4444 (boundp 'org-emphasis-regexp-components)
4445 org-emphasis-alist org-emphasis-regexp-components)
4446 (let* ((e org-emphasis-regexp-components)
4447 (pre (car e))
4448 (post (nth 1 e))
4449 (border (nth 2 e))
4450 (body (nth 3 e))
4451 (nl (nth 4 e))
4452 (body1 (concat body "*?"))
4453 (markers (mapconcat 'car org-emphasis-alist ""))
4454 (vmarkers (mapconcat
4455 (lambda (x) (if (eq (nth 2 x) 'verbatim) (car x) ""))
4456 org-emphasis-alist "")))
4457 ;; make sure special characters appear at the right position in the class
4458 (if (string-match "\\^" markers)
4459 (setq markers (concat (replace-match "" t t markers) "^")))
4460 (if (string-match "-" markers)
4461 (setq markers (concat (replace-match "" t t markers) "-")))
4462 (if (string-match "\\^" vmarkers)
4463 (setq vmarkers (concat (replace-match "" t t vmarkers) "^")))
4464 (if (string-match "-" vmarkers)
4465 (setq vmarkers (concat (replace-match "" t t vmarkers) "-")))
4466 (if (> nl 0)
4467 (setq body1 (concat body1 "\\(?:\n" body "*?\\)\\{0,"
4468 (int-to-string nl) "\\}")))
4469 ;; Make the regexp
4470 (setq org-emph-re
4471 (concat "\\([" pre "]\\|^\\)"
4472 "\\("
4473 "\\([" markers "]\\)"
4474 "\\("
4475 "[^" border "]\\|"
4476 "[^" border "]"
4477 body1
4478 "[^" border "]"
4479 "\\)"
4480 "\\3\\)"
4481 "\\([" post "]\\|$\\)"))
4482 (setq org-verbatim-re
4483 (concat "\\([" pre "]\\|^\\)"
4484 "\\("
4485 "\\([" vmarkers "]\\)"
4486 "\\("
4487 "[^" border "]\\|"
4488 "[^" border "]"
4489 body1
4490 "[^" border "]"
4491 "\\)"
4492 "\\3\\)"
4493 "\\([" post "]\\|$\\)")))))
4495 ;; This used to be a defcustom (Org <8.0) but allowing the users to
4496 ;; set this option proved cumbersome. See this message/thread:
4497 ;;
4498 (defvar org-emphasis-regexp-components
4499 '(" \t('\"{" "- \t.,:!?;'\")}\\[" " \t\r\n" "." 1)
4500 "Components used to build the regular expression for emphasis.
4501 This is a list with five entries. Terminology: In an emphasis string
4502 like \" *strong word* \", we call the initial space PREMATCH, the final
4503 space POSTMATCH, the stars MARKERS, \"s\" and \"d\" are BORDER characters
4504 and \"trong wor\" is the body. The different components in this variable
4505 specify what is allowed/forbidden in each part:
4507 pre Chars allowed as prematch. Beginning of line will be allowed too.
4508 post Chars allowed as postmatch. End of line will be allowed too.
4509 border The chars *forbidden* as border characters.
4510 body-regexp A regexp like \".\" to match a body character. Don't use
4511 non-shy groups here, and don't allow newline here.
4512 newline The maximum number of newlines allowed in an emphasis exp.
4514 You need to reload Org or to restart Emacs after customizing this.")
4516 (defcustom org-emphasis-alist
4517 '(("*" bold)
4518 ("/" italic)
4519 ("_" underline)
4520 ("=" org-verbatim verbatim)
4521 ("~" org-code verbatim)
4522 ("+" (:strike-through t)))
4523 "Alist of characters and faces to emphasize text.
4524 Text starting and ending with a special character will be emphasized,
4525 for example *bold*, _underlined_ and /italic/. This variable sets the
4526 marker characters and the face to be used by font-lock for highlighting
4527 in Org buffers.
4529 You need to reload Org or to restart Emacs after customizing this."
4530 :group 'org-appearance
4531 :set 'org-set-emph-re
4532 :version "24.4"
4533 :package-version '(Org . "8.0")
4534 :type '(repeat
4535 (list
4536 (string :tag "Marker character")
4537 (choice
4538 (face :tag "Font-lock-face")
4539 (plist :tag "Face property list"))
4540 (option (const verbatim)))))
4542 (defvar org-protecting-blocks '("src" "example" "export")
4543 "Blocks that contain text that is quoted, i.e. not processed as Org syntax.
4544 This is needed for font-lock setup.")
4546 ;;; Functions and variables from their packages
4547 ;; Declared here to avoid compiler warnings
4548 (defvar mark-active)
4550 ;; Various packages
4551 (declare-function calc-eval "calc" (str &optional separator &rest args))
4552 (declare-function calendar-forward-day "cal-move" (arg))
4553 (declare-function calendar-goto-date "cal-move" (date))
4554 (declare-function calendar-goto-today "cal-move" ())
4555 (declare-function calendar-iso-from-absolute "cal-iso" (date))
4556 (declare-function calendar-iso-to-absolute "cal-iso" (date))
4557 (declare-function cdlatex-compute-tables "ext:cdlatex" ())
4558 (declare-function cdlatex-tab "ext:cdlatex" ())
4559 (declare-function dired-get-filename
4560 "dired"
4561 (&optional localp no-error-if-not-filep))
4562 (declare-function iswitchb-read-buffer
4563 "iswitchb"
4564 (prompt &optional
4565 default require-match _predicate start matches-set))
4566 (declare-function org-agenda-change-all-lines
4567 "org-agenda"
4568 (newhead hdmarker &optional fixface just-this))
4569 (declare-function org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item
4570 "org-agenda"
4571 (&optional end))
4572 (declare-function org-agenda-copy-local-variable "org-agenda" (var))
4573 (declare-function org-agenda-format-item
4574 "org-agenda"
4575 (extra txt &optional level category tags dotime
4576 remove-re habitp))
4577 (declare-function org-agenda-maybe-redo "org-agenda" ())
4578 (declare-function org-agenda-new-marker "org-agenda" (&optional pos))
4579 (declare-function org-agenda-save-markers-for-cut-and-paste
4580 "org-agenda"
4581 (beg end))
4582 (declare-function org-agenda-set-restriction-lock "org-agenda" (&optional type))
4583 (declare-function org-agenda-skip "org-agenda" ())
4584 (declare-function org-attach-reveal "org-attach" (&optional if-exists))
4585 (declare-function org-gnus-follow-link "org-gnus" (&optional group article))
4586 (declare-function org-indent-mode "org-indent" (&optional arg))
4587 (declare-function org-inlinetask-goto-beginning "org-inlinetask" ())
4588 (declare-function org-inlinetask-goto-end "org-inlinetask" ())
4589 (declare-function org-inlinetask-in-task-p "org-inlinetask" ())
4590 (declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
4591 (declare-function orgtbl-send-table "org-table" (&optional maybe))
4592 (declare-function parse-time-string "parse-time" (string))
4593 (declare-function speedbar-line-directory "speedbar" (&optional depth))
4594 (declare-function table--at-cell-p
4595 "table"
4596 (position &optional object at-column))
4598 (defvar align-mode-rules-list)
4599 (defvar calc-embedded-close-formula)
4600 (defvar calc-embedded-open-formula)
4601 (defvar calc-embedded-open-mode)
4602 (defvar font-lock-unfontify-region-function)
4603 (defvar iswitchb-temp-buflist)
4604 (defvar org-agenda-tags-todo-honor-ignore-options)
4605 (defvar remember-data-file)
4606 (defvar texmathp-why)
4608 ;;;###autoload
4609 (defun turn-on-orgtbl ()
4610 "Unconditionally turn on `orgtbl-mode'."
4611 (require 'org-table)
4612 (orgtbl-mode 1))
4614 (defun org-at-table-p (&optional table-type)
4615 "Non-nil if the cursor is inside an Org table.
4616 If TABLE-TYPE is non-nil, also check for table.el-type tables.
4617 If `org-enable-table-editor' is nil, return nil unconditionally."
4618 (and
4619 org-enable-table-editor
4620 (save-excursion
4621 (beginning-of-line)
4622 (looking-at-p (if table-type "[ \t]*[|+]" "[ \t]*|")))
4623 (or (not (derived-mode-p 'org-mode))
4624 (let ((e (org-element-lineage (org-element-at-point) '(table) t)))
4625 (and e (or table-type (eq (org-element-property :type e) 'org)))))))
4627 (defun org-at-table.el-p ()
4628 "Non-nil when point is at a table.el table."
4629 (and (save-excursion (beginning-of-line) (looking-at "[ \t]*[|+]"))
4630 (let ((element (org-element-at-point)))
4631 (and (eq (org-element-type element) 'table)
4632 (eq (org-element-property :type element) 'table.el)))))
4634 (defun org-table-recognize-table.el ()
4635 "If there is a table.el table nearby, recognize it and move into it."
4636 (when (and org-table-tab-recognizes-table.el (org-at-table.el-p))
4637 (beginning-of-line)
4638 (unless (or (looking-at org-table-dataline-regexp)
4639 (not (looking-at org-table1-hline-regexp)))
4640 (forward-line)
4641 (when (looking-at org-table-any-border-regexp)
4642 (forward-line -2)))
4643 (if (re-search-forward "|" (org-table-end t) t)
4644 (progn
4645 (require 'table)
4646 (if (table--at-cell-p (point)) t
4647 (message "recognizing table.el table...")
4648 (table-recognize-table)
4649 (message "