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