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