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