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