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