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