;;; org.el --- Outline-based notes management and organizer -*- lexical-binding: t; -*-
;; Carstens outline-mode for keeping track of everything.
;; Copyright (C) 2004-2023 Free Software Foundation, Inc.
;;
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Maintainer: Bastien Guerry <bzg@gnu.org>
;; Keywords: outlines, hypermedia, calendar, wp
;; URL: https://orgmode.org
;; Package-Requires: ((emacs "26.1"))
;; Version: 9.7-pre
;; This file is part of GNU Emacs.
;;
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;; Commentary:
;;
;; Org is a mode for keeping notes, maintaining ToDo lists, and doing
;; project planning with a fast and effective plain-text system.
;;
;; Org mode develops organizational tasks around NOTES files that
;; contain information about projects as plain text. Org mode is
;; implemented on top of outline-mode, which makes it possible to keep
;; the content of large files well structured. Visibility cycling and
;; structure editing help to work with the tree. Tables are easily
;; created with a built-in table editor. Org mode supports ToDo
;; items, deadlines, time stamps, and scheduling. It dynamically
;; compiles entries into an agenda that utilizes and smoothly
;; integrates much of the Emacs calendar and diary. Plain text
;; URL-like links connect to websites, emails, Usenet messages, BBDB
;; entries, and any files related to the projects. For printing and
;; sharing of notes, an Org file can be exported as a structured ASCII
;; file, as HTML, or (todo and agenda items only) as an iCalendar
;; file. It can also serve as a publishing tool for a set of linked
;; webpages.
;;
;; Installation and Activation
;; ---------------------------
;; See the corresponding sections in the manual at
;;
;; https://orgmode.org/org.html#Installation
;;
;; Documentation
;; -------------
;; The documentation of Org mode can be found in the TeXInfo file. The
;; distribution also contains a PDF version of it. At the Org mode website,
;; you can read the same text online as HTML. There is also an excellent
;; reference card made by Philip Rooke. This card can be found in the
;; doc/ directory.
;;
;; A list of recent changes can be found at
;; https://orgmode.org/Changes.html
;;
;;; Code:
(defvar org-inhibit-highlight-removal nil) ; dynamically scoped param
(defvar org-inlinetask-min-level)
;;;; Require other packages
(require 'org-compat)
(org-assert-version)
(require 'cl-lib)
(eval-when-compile (require 'gnus-sum))
(require 'calendar)
(require 'find-func)
(require 'format-spec)
(condition-case nil
(load (concat (file-name-directory load-file-name)
"org-loaddefs")
nil t nil t)
(error
(message "WARNING: No org-loaddefs.el file could be found from where org.el is loaded.")
(sit-for 3)
(message "You need to run \"make\" or \"make autoloads\" from Org lisp directory")
(sit-for 3)))
(eval-and-compile (require 'org-macs))
(require 'org-compat)
(require 'org-keys)
(require 'ol)
(require 'oc)
(require 'org-table)
(require 'org-fold)
(require 'org-cycle)
(defvaralias 'org-hide-block-startup 'org-cycle-hide-block-startup)
(defvaralias 'org-hide-drawer-startup 'org-cycle-hide-drawer-startup)
(defvaralias 'org-pre-cycle-hook 'org-cycle-pre-hook)
(defvaralias 'org-tab-first-hook 'org-cycle-tab-first-hook)
(defalias 'org-global-cycle #'org-cycle-global)
(defalias 'org-overview #'org-cycle-overview)
(defalias 'org-content #'org-cycle-content)
(defalias 'org-reveal #'org-fold-reveal)
(defalias 'org-force-cycle-archived #'org-cycle-force-archived)
;; `org-outline-regexp' ought to be a defconst but is let-bound in
;; some places -- e.g. see the macro `org-with-limited-levels'.
(defvar org-outline-regexp "\\*+ "
"Regexp to match Org headlines.")
(defvar org-outline-regexp-bol "^\\*+ "
"Regexp to match Org headlines.
This is similar to `org-outline-regexp' but additionally makes
sure that we are at the beginning of the line.")
(defvar org-heading-regexp "^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
"Matches a headline, putting stars and text into groups.
Stars are put in group 1 and the trimmed body in group 2.")
(declare-function calendar-check-holidays "holidays" (date))
(declare-function cdlatex-environment "ext:cdlatex" (environment item))
(declare-function cdlatex-math-symbol "ext:cdlatex")
(declare-function Info-goto-node "info" (nodename &optional fork strict-case))
(declare-function isearch-no-upper-case-p "isearch" (string regexp-flag))
(declare-function org-add-archive-files "org-archive" (files))
(declare-function org-agenda-entry-get-agenda-timestamp "org-agenda" (pom))
(declare-function org-agenda-todo-yesterday "org-agenda" (&optional arg))
(declare-function org-agenda-list "org-agenda" (&optional arg start-day span with-hour))
(declare-function org-agenda-redo "org-agenda" (&optional all))
(declare-function org-agenda-remove-restriction-lock "org-agenda" (&optional noupdate))
(declare-function org-archive-subtree "org-archive" (&optional find-done))
(declare-function org-archive-subtree-default "org-archive" ())
(declare-function org-archive-to-archive-sibling "org-archive" ())
(declare-function org-attach "org-attach" ())
(declare-function org-attach-dir "org-attach"
(&optional create-if-not-exists-p no-fs-check))
(declare-function org-babel-do-in-edit-buffer "ob-core" (&rest body) t)
(declare-function org-babel-tangle-file "ob-tangle" (file &optional target-file lang))
(declare-function org-beamer-mode "ox-beamer" (&optional prefix) t)
(declare-function org-clock-auto-clockout "org-clock" ())
(declare-function org-clock-cancel "org-clock" ())
(declare-function org-clock-display "org-clock" (&optional arg))
(declare-function org-clock-get-last-clock-out-time "org-clock" ())
(declare-function org-clock-goto "org-clock" (&optional select))
(declare-function org-clock-in "org-clock" (&optional select start-time))
(declare-function org-clock-in-last "org-clock" (&optional arg))
(declare-function org-clock-out "org-clock" (&optional switch-to-state fail-quietly at-time))
(declare-function org-clock-out-if-current "org-clock" ())
(declare-function org-clock-remove-overlays "org-clock" (&optional beg end noremove))
(declare-function org-clock-report "org-clock" (&optional arg))
(declare-function org-clock-sum "org-clock" (&optional tstart tend headline-filter propname))
(declare-function org-clock-sum-current-item "org-clock" (&optional tstart))
(declare-function org-clock-timestamps-down "org-clock" (&optional n))
(declare-function org-clock-timestamps-up "org-clock" (&optional n))
(declare-function org-clock-update-time-maybe "org-clock" ())
(declare-function org-clocktable-shift "org-clock" (dir n))
(declare-function org-columns-quit "org-colview" ())
(declare-function org-columns-insert-dblock "org-colview" ())
(declare-function org-duration-from-minutes "org-duration" (minutes &optional fmt canonical))
(declare-function org-duration-to-minutes "org-duration" (duration &optional canonical))
(declare-function org-element-at-point "org-element" (&optional pom cached-only))
(declare-function org-element-at-point-no-context "org-element" (&optional pom))
(declare-function org-element-cache-refresh "org-element" (pos))
(declare-function org-element-cache-reset "org-element" (&optional all no-persistence))
(declare-function org-element-cache-map "org-element" (func &rest keys))
(declare-function org-element-contents "org-element" (element))
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-copy "org-element" (datum))
(declare-function org-element-create "org-element" (type &optional props &rest children))
(declare-function org-element-extract-element "org-element" (element))
(declare-function org-element-insert-before "org-element" (element location))
(declare-function org-element-interpret-data "org-element" (data))
(declare-function org-element-keyword-parser "org-element" (limit affiliated))
(declare-function org-element-lineage "org-element" (blob &optional types with-self))
(declare-function org-element-link-parser "org-element" ())
(declare-function org-element-map "org-element" (data types fun &optional info first-match no-recursion with-affiliated))
(declare-function org-element-nested-p "org-element" (elem-a elem-b))
(declare-function org-element-parse-buffer "org-element" (&optional granularity visible-only))
(declare-function org-element-parse-secondary-string "org-element" (string restriction &optional parent))
(declare-function org-element-property "org-element" (property element))
(declare-function org-element-put-property "org-element" (element property value))
(declare-function org-element-restriction "org-element" (element))
(declare-function org-element-swap-A-B "org-element" (elem-a elem-b))
(declare-function org-element-timestamp-parser "org-element" ())
(declare-function org-element-type "org-element" (element))
(declare-function org-element--cache-active-p "org-element" ())
(declare-function org-export-dispatch "ox" (&optional arg))
(declare-function org-export-get-backend "ox" (name))
(declare-function org-export-get-environment "ox" (&optional backend subtreep ext-plist))
(declare-function org-feed-goto-inbox "org-feed" (feed))
(declare-function org-feed-update-all "org-feed" ())
(declare-function org-goto "org-goto" (&optional alternative-interface))
(declare-function org-id-find-id-file "org-id" (id))
(declare-function org-id-get-create "org-id" (&optional force))
(declare-function org-inlinetask-at-task-p "org-inlinetask" ())
(declare-function org-inlinetask-outline-regexp "org-inlinetask" ())
(declare-function org-inlinetask-toggle-visibility "org-inlinetask" ())
(declare-function org-latex-make-preamble "ox-latex" (info &optional template snippet?))
(declare-function org-num-mode "org-num" (&optional arg))
(declare-function org-plot/gnuplot "org-plot" (&optional params))
(declare-function org-persist-load "org-persist")
(declare-function org-tags-view "org-agenda" (&optional todo-only match))
(declare-function org-timer "org-timer" (&optional restart no-insert))
(declare-function org-timer-item "org-timer" (&optional arg))
(declare-function org-timer-pause-or-continue "org-timer" (&optional stop))
(declare-function org-timer-set-timer "org-timer" (&optional opt))
(declare-function org-timer-start "org-timer" (&optional offset))
(declare-function org-timer-stop "org-timer" ())
(declare-function org-toggle-archive-tag "org-archive" (&optional find-done))
(declare-function org-update-radio-target-regexp "ol" ())
(defvar org-agenda-buffer-name)
(defvar org-element-paragraph-separate)
(defvar org-element-cache-map-continue-from)
(defvar org-element--timestamp-regexp)
(defvar org-indent-indentation-per-level)
(defvar org-radio-target-regexp)
(defvar org-target-link-regexp)
(defvar org-target-regexp)
(defvar org-id-overriding-file-name)
;; load languages based on value of `org-babel-load-languages'
(defvar org-babel-load-languages)
(defvar crm-separator) ; dynamically scoped param
;;;###autoload
(defun org-babel-do-load-languages (sym value)
"Load the languages defined in `org-babel-load-languages'."
(set-default-toplevel-value sym value)
(dolist (pair org-babel-load-languages)
(let ((active (cdr pair)) (lang (symbol-name (car pair))))
(if active
(require (intern (concat "ob-" lang)))
(fmakunbound
(intern (concat "org-babel-execute:" lang)))
(fmakunbound
(intern (concat "org-babel-expand-body:" lang)))))))
;;;###autoload
(defun org-babel-load-file (file &optional compile)
"Load Emacs Lisp source code blocks in the Org FILE.
This function exports the source code using `org-babel-tangle'
and then loads the resulting file using `load-file'. With
optional prefix argument COMPILE, the tangled Emacs Lisp file is
byte-compiled before it is loaded."
(interactive "fFile to load: \nP")
(let ((tangled-file (concat (file-name-sans-extension file) ".el")))
;; Tangle only if the Elisp file is older than the Org file.
;; Catch the case when the .el file exists while the .org file is missing.
(unless (file-exists-p file)
(error "File to tangle does not exist: %s" file))
(when (file-newer-than-file-p file tangled-file)
(org-babel-tangle-file file
tangled-file
(rx string-start
(or "emacs-lisp" "elisp")
string-end))
;; Make sure that tangled file modification time is
;; updated even when `org-babel-tangle-file' does not make changes.
;; This avoids re-tangling changed FILE where the changes did
;; not affect the tangled code.
(when (file-exists-p tangled-file)
(set-file-times tangled-file)))
(if compile
(progn
(byte-compile-file tangled-file)
(load-file (byte-compile-dest-file tangled-file))
(message "Compiled and loaded %s" tangled-file))
(load-file tangled-file)
(message "Loaded %s" tangled-file))))
(defcustom org-babel-load-languages '((emacs-lisp . t))
"Languages which can be evaluated in Org buffers.
\\<org-mode-map>
This list can be used to load support for any of the available
languages with babel support (see info node `(org) Languages'). Each
language will depend on a different set of system executables and/or
Emacs modes.
When a language is \"loaded\", code blocks in that language can
be evaluated with `org-babel-execute-src-block', which is bound
by default to \\[org-ctrl-c-ctrl-c].
The `org-babel-no-eval-on-ctrl-c-ctrl-c' option can be set to
remove code block evaluation from \\[org-ctrl-c-ctrl-c]. By
default, only Emacs Lisp is loaded, since it has no specific
requirement."
:group 'org-babel
:set 'org-babel-do-load-languages
:package-version '(Org . "9.6")
:type '(alist :tag "Babel Languages"
:key-type
(choice
(const :tag "Awk" awk)
(const :tag "C, D, C++, and cpp" C)
(const :tag "R" R)
(const :tag "Calc" calc)
(const :tag "Clojure and ClojureScript" clojure)
(const :tag "CSS" css)
(const :tag "Ditaa" ditaa)
(const :tag "Dot" dot)
(const :tag "Emacs Lisp" emacs-lisp)
(const :tag "Eshell" eshell)
(const :tag "Forth" forth)
(const :tag "Fortran" fortran)
(const :tag "GnuPlot" gnuplot)
(const :tag "Groovy" groovy)
(const :tag "Haskell" haskell)
(const :tag "Java" java)
(const :tag "JavaScript" js)
(const :tag "Julia" julia)
(const :tag "LaTeX" latex)
(const :tag "LilyPond" lilypond)
(const :tag "Lisp" lisp)
(const :tag "Lua" lua)
(const :tag "Makefile" makefile)
(const :tag "Maxima" maxima)
(const :tag "OCaml" ocaml)
(const :tag "Octave and MatLab" octave)
(const :tag "Org" org)
(const :tag "Perl" perl)
(const :tag "Processing" processing)
(const :tag "PlantUML" plantuml)
(const :tag "Python" python)
(const :tag "Ruby" ruby)
(const :tag "Sass" sass)
(const :tag "Scheme" scheme)
(const :tag "Screen" screen)
(const :tag "Sed" sed)
(const :tag "Shell Script" shell)
(const :tag "Sql" sql)
(const :tag "Sqlite" sqlite))
:value-type (boolean :tag "Activate" :value t)))
;;;; Customization variables
(defcustom org-clone-delete-id nil
"Remove ID property of clones of a subtree.
When non-nil, clones of a subtree don't inherit the ID property.
Otherwise they inherit the ID property with a new unique
identifier."
:type 'boolean
:version "24.1"
:group 'org-id)
;;; Version
(org-check-version)
;;;###autoload
(defun org-version (&optional here full message)
"Show the Org version.
Interactively, or when MESSAGE is non-nil, show it in echo area.
With prefix argument, or when HERE is non-nil, insert it at point.
In non-interactive uses, a reduced version string is output unless
FULL is given."
(interactive (list current-prefix-arg t (not current-prefix-arg)))
(let ((org-dir (ignore-errors (org-find-library-dir "org")))
(save-load-suffixes load-suffixes)
(load-suffixes (list ".el"))
(org-install-dir
(ignore-errors (org-find-library-dir "org-loaddefs"))))
(unless (and (fboundp 'org-release) (fboundp 'org-git-version))
(org-load-noerror-mustsuffix (concat org-dir "org-version")))
(let* ((load-suffixes save-load-suffixes)
(release (org-release))
(git-version (org-git-version))
(version (format "Org mode version %s (%s @ %s)"
release
git-version
(if org-install-dir
(if (string= org-dir org-install-dir)
org-install-dir
(concat "mixed installation! "
org-install-dir
" and "
org-dir))
"org-loaddefs.el can not be found!")))
(version1 (if full version release)))
(when here (insert version1))
(when message (message "%s" version1))
version1)))
(defconst org-version (org-version))
\f
;;; Syntax Constants
;;;; Comments
(defconst org-comment-regexp
(rx (seq bol (zero-or-more (any "\t ")) "#" (or " " eol)))
"Regular expression for comment lines.")
;;;; Keyword
(defconst org-keyword-regexp "^[ \t]*#\\+\\(\\S-+?\\):[ \t]*\\(.*\\)$"
"Regular expression for keyword-lines.")
;;;; Block
(defconst org-block-regexp
"^[ \t]*#\\+begin_?\\([^ \n]+\\)\\(\\([^\n]+\\)\\)?\n\\([^\000]+?\\)#\\+end_?\\1[ \t]*$"
"Regular expression for hiding blocks.")
(defconst org-dblock-start-re
"^[ \t]*#\\+\\(?:BEGIN\\|begin\\):[ \t]+\\(\\S-+\\)\\([ \t]+\\(.*\\)\\)?"
"Matches the start line of a dynamic block, with parameters.")
(defconst org-dblock-end-re "^[ \t]*#\\+\\(?:END\\|end\\)\\([: \t\r\n]\\|$\\)"
"Matches the end of a dynamic block.")
;;;; Timestamp
(defconst org-ts--internal-regexp
(rx (seq
(= 4 digit) "-" (= 2 digit) "-" (= 2 digit)
(optional " " (*? nonl))))
"Regular expression matching the innards of a time stamp.")
(defconst org-ts-regexp (format "<\\(%s\\)>" org-ts--internal-regexp)
"Regular expression for fast time stamp matching.")
(defconst org-ts-regexp-inactive
(format "\\[\\(%s\\)\\]" org-ts--internal-regexp)
"Regular expression for fast inactive time stamp matching.")
(defconst org-ts-regexp-both (format "[[<]\\(%s\\)[]>]" org-ts--internal-regexp)
"Regular expression for fast time stamp matching.")
(defconst org-ts-regexp0
"\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\( +[^]+0-9>\r\n -]+\\)?\\( +\\([0-9]\\{1,2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
"Regular expression matching time strings for analysis.
This one does not require the space after the date, so it can be used
on a string that terminates immediately after the date.")
(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\(?: *\\([^]+0-9>\r\n -]+\\)\\)?\\( \\([0-9]\\{1,2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
"Regular expression matching time strings for analysis.")
(defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,16\\}>")
"Regular expression matching time stamps, with groups.")
(defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[^]>\n]\\{0,16\\}[]>]")
"Regular expression matching time stamps (also [..]), with groups.")
(defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp)
"Regular expression matching a time stamp range.")
(defconst org-tr-regexp-both
(concat org-ts-regexp-both "--?-?" org-ts-regexp-both)
"Regular expression matching a time stamp range.")
(defconst org-tsr-regexp (concat org-ts-regexp "\\(--?-?"
org-ts-regexp "\\)?")
"Regular expression matching a time stamp or time stamp range.")
(defconst org-tsr-regexp-both
(concat org-ts-regexp-both "\\(--?-?"
org-ts-regexp-both "\\)?")
"Regular expression matching a time stamp or time stamp range.
The time stamps may be either active or inactive.")
(defconst org-repeat-re
"<[0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9] [^>\n]*?\
\\([.+]?\\+[0-9]+[hdwmy]\\(/[0-9]+[hdwmy]\\)?\\)"
"Regular expression for specifying repeated events.
After a match, group 1 contains the repeat expression.")
(defconst org-time-stamp-formats '("%Y-%m-%d %a" . "%Y-%m-%d %a %H:%M")
"Formats for `format-time-string' which are used for time stamps.
The value is a cons cell containing two strings. The `car' and `cdr'
of the cons cell are used to format time stamps that do not and do
contain time, respectively.
Leading \"<\"/\"[\" and trailing \">\"/\"]\" pair will be stripped
from the format strings.
Also, see `org-time-stamp-format'.")
;;;; Clock and Planning
(defconst org-clock-string "CLOCK:"
"String used as prefix for timestamps clocking work hours on an item.")
(defvar org-closed-string "CLOSED:"
"String used as the prefix for timestamps logging closing a TODO entry.")
(defvar org-deadline-string "DEADLINE:"
"String to mark deadline entries.
\\<org-mode-map>
A deadline is this string, followed by a time stamp. It must be
a word, terminated by a colon. You can insert a schedule keyword
and a timestamp with `\\[org-deadline]'.")
(defvar org-scheduled-string "SCHEDULED:"
"String to mark scheduled TODO entries.
\\<org-mode-map>
A schedule is this string, followed by a time stamp. It must be
a word, terminated by a colon. You can insert a schedule keyword
and a timestamp with `\\[org-schedule]'.")
(defconst org-ds-keyword-length
(+ 2
(apply #'max
(mapcar #'length
(list org-deadline-string org-scheduled-string
org-clock-string org-closed-string))))
"Maximum length of the DEADLINE and SCHEDULED keywords.")
(defconst org-planning-line-re
(concat "^[ \t]*"
(regexp-opt
(list org-closed-string org-deadline-string org-scheduled-string)
t))
"Matches a line with planning info.
Matched keyword is in group 1.")
(defconst org-clock-line-re
(concat "^[ \t]*" org-clock-string)
"Matches a line with clock info.")
(defconst org-deadline-regexp (concat "\\<" org-deadline-string)
"Matches the DEADLINE keyword.")
(defconst org-deadline-time-regexp
(concat "\\<" org-deadline-string " *<\\([^>]+\\)>")
"Matches the DEADLINE keyword together with a time stamp.")
(defconst org-deadline-time-hour-regexp
(concat "\\<" org-deadline-string
" *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9+:hdwmy/ \t.-]*\\)>")
"Matches the DEADLINE keyword together with a time-and-hour stamp.")
(defconst org-deadline-line-regexp
(concat "\\<\\(" org-deadline-string "\\).*")
"Matches the DEADLINE keyword and the rest of the line.")
(defconst org-scheduled-regexp (concat "\\<" org-scheduled-string)
"Matches the SCHEDULED keyword.")
(defconst org-scheduled-time-regexp
(concat "\\<" org-scheduled-string " *<\\([^>]+\\)>")
"Matches the SCHEDULED keyword together with a time stamp.")
(defconst org-scheduled-time-hour-regexp
(concat "\\<" org-scheduled-string
" *<\\([^>]+[0-9]\\{1,2\\}:[0-9]\\{2\\}[0-9+:hdwmy/ \t.-]*\\)>")
"Matches the SCHEDULED keyword together with a time-and-hour stamp.")
(defconst org-closed-time-regexp
(concat "\\<" org-closed-string " *\\[\\([^]]+\\)\\]")
"Matches the CLOSED keyword together with a time stamp.")
(defconst org-keyword-time-regexp
(concat "\\<"
(regexp-opt
(list org-scheduled-string org-deadline-string org-closed-string
org-clock-string)
t)
" *[[<]\\([^]>]+\\)[]>]")
"Matches any of the 4 keywords, together with the time stamp.")
(defconst org-keyword-time-not-clock-regexp
(concat
"\\<"
(regexp-opt
(list org-scheduled-string org-deadline-string org-closed-string) t)
" *[[<]\\([^]>]+\\)[]>]")
"Matches any of the 3 keywords, together with the time stamp.")
(defconst org-all-time-keywords
(mapcar (lambda (w) (substring w 0 -1))
(list org-scheduled-string org-deadline-string
org-clock-string org-closed-string))
"List of time keywords.")
;;;; Drawer
(defconst org-drawer-regexp "^[ \t]*:\\(\\(?:\\w\\|[-_]\\)+\\):[ \t]*$"
"Matches first or last line of a hidden block.
Group 1 contains drawer's name or \"END\".")
(defconst org-property-start-re "^[ \t]*:PROPERTIES:[ \t]*$"
"Regular expression matching the first line of a property drawer.")
(defconst org-property-end-re "^[ \t]*:END:[ \t]*$"
"Regular expression matching the last line of a property drawer.")
(defconst org-clock-drawer-start-re "^[ \t]*:CLOCK:[ \t]*$"
"Regular expression matching the first line of a clock drawer.")
(defconst org-clock-drawer-end-re "^[ \t]*:END:[ \t]*$"
"Regular expression matching the last line of a clock drawer.")
(defconst org-logbook-drawer-re
(rx (seq bol (0+ (any "\t ")) ":LOGBOOK:" (0+ (any "\t ")) "\n"
(*? (0+ nonl) "\n")
(0+ (any "\t ")) ":END:" (0+ (any "\t ")) eol))
"Matches an entire LOGBOOK drawer.")
(defconst org-property-drawer-re
(concat "^[ \t]*:PROPERTIES:[ \t]*\n"
"\\(?:[ \t]*:\\S-+:\\(?:[ \t].*\\)?[ \t]*\n\\)*?"
"[ \t]*:END:[ \t]*$")
"Matches an entire property drawer.")
(defconst org-clock-drawer-re
(concat "\\(" org-clock-drawer-start-re "\\)[^\000]*?\\("
org-clock-drawer-end-re "\\)\n?")
"Matches an entire clock drawer.")
;;;; Headline
(defconst org-heading-keyword-regexp-format
"^\\(\\*+\\)\\(?: +%s\\)\\(?: +\\(.*?\\)\\)?[ \t]*$"
"Printf format for a regexp matching a headline with some keyword.
This regexp will match the headline of any node which has the
exact keyword that is put into the format. The keyword isn't in
any group by default, but the stars and the body are.")
(defconst org-heading-keyword-maybe-regexp-format
"^\\(\\*+\\)\\(?: +%s\\)?\\(?: +\\(.*?\\)\\)?[ \t]*$"
"Printf format for a regexp matching a headline, possibly with some keyword.
This regexp can match any headline with the specified keyword, or
without a keyword. The keyword isn't in any group by default,
but the stars and the body are.")
(defconst org-archive-tag "ARCHIVE"
"The tag that marks a subtree as archived.
An archived subtree does not open during visibility cycling, and does
not contribute to the agenda listings.")
(defconst org-tag-re "[[:alnum:]_@#%]+"
"Regexp matching a single tag.")
(defconst org-tag-group-re "[ \t]+\\(:\\([[:alnum:]_@#%:]+\\):\\)[ \t]*$"
"Regexp matching the tag group at the end of a line, with leading spaces.
Tags are stored in match group 1. Match group 2 stores the tags
without the enclosing colons.")
(defconst org-tag-line-re
"^\\*+ \\(?:.*[ \t]\\)?\\(:\\([[:alnum:]_@#%:]+\\):\\)[ \t]*$"
"Regexp matching tags in a headline.
Tags are stored in match group 1. Match group 2 stores the tags
without the enclosing colons.")
(eval-and-compile
(defconst org-comment-string "COMMENT"
"Entries starting with this keyword will never be exported.
\\<org-mode-map>
An entry can be toggled between COMMENT and normal with
`\\[org-toggle-comment]'."))
;;;; LaTeX Environments and Fragments
(defconst org-latex-regexps
'(("begin" "^[ \t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t)
;; ("$" "\\([ \t(]\\|^\\)\\(\\(\\([$]\\)\\([^ \t\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \t\n,.$]\\)\\4\\)\\)\\([ \t.,?;:'\")]\\|$\\)" 2 nil)
;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p
("$1" "\\([^$]\\|^\\)\\(\\$[^ \t\r\n,;.$]\\$\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|'\\|$\\)" 2 nil)
("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^ \t\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \t\n,.$]\\)\\$\\)\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|'\\|$\\)" 2 nil)
("\\(" "\\\\([^\000]*?\\\\)" 0 nil)
("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 nil)
("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil))
"Regular expressions for matching embedded LaTeX.")
;;;; Node Property
(defconst org-effort-property "Effort"
"The property that is being used to keep track of effort estimates.
Effort estimates given in this property need to be in the format
defined in org-duration.el.")
\f
;;; The custom variables
(defgroup org nil
"Outline-based notes management and organizer."
:tag "Org"
:group 'outlines
:group 'calendar)
(defcustom org-mode-hook nil
"Mode hook for Org mode, run after the mode was turned on."
:group 'org
:type 'hook)
(defcustom org-load-hook nil
"Hook that is run after org.el has been loaded."
:group 'org
:type 'hook)
(make-obsolete-variable
'org-load-hook
"use `with-eval-after-load' instead." "9.5")
(defcustom org-log-buffer-setup-hook nil
"Hook that is run after an Org log buffer is created."
:group 'org
:version "24.1"
:type 'hook)
(defvar org-modules) ; defined below
(defvar org-modules-loaded nil
"Have the modules been loaded already?")
;;;###autoload
(defun org-load-modules-maybe (&optional force)
"Load all extensions listed in `org-modules'."
(when (or force (not org-modules-loaded))
(dolist (ext org-modules)
(condition-case nil (require ext)
(error (message "Problems while trying to load feature `%s'" ext))))
(setq org-modules-loaded t)))
(defun org-set-modules (var value)
"Set VAR to VALUE and call `org-load-modules-maybe' with the force flag."
(set-default-toplevel-value var value)
(when (featurep 'org)
(org-load-modules-maybe 'force)
;; FIXME: We can't have all the requires at top-level due to
;; circular dependencies. Yet, this function might sometimes be
;; called when 'org-element is not loaded.
(require 'org-element)
(org-element-cache-reset 'all)))
(defcustom org-modules '(ol-doi ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus ol-info ol-irc ol-mhe ol-rmail ol-eww)
"Modules that should always be loaded together with org.el.
If a description starts with <C>, the file is not part of Emacs and Org mode,
so loading it will require that you have properly installed org-contrib
package from NonGNU Emacs Lisp Package Archive
https://elpa.nongnu.org/nongnu/org-contrib.html
You can also use this system to load external packages (i.e. neither Org
core modules, nor org-contrib modules). Just add symbols
to the end of the list. If the package is called org-xyz.el, then you need
to add the symbol `xyz', and the package must have a call to:
(provide \\='org-xyz)
For export specific modules, see also `org-export-backends'."
:group 'org
:set 'org-set-modules
:package-version '(Org . "9.5")
:type
'(set :greedy t
(const :tag " bbdb: Links to BBDB entries" ol-bbdb)
(const :tag " bibtex: Links to BibTeX entries" ol-bibtex)
(const :tag " crypt: Encryption of subtrees" org-crypt)
(const :tag " ctags: Access to Emacs tags with links" org-ctags)
(const :tag " docview: Links to Docview buffers" ol-docview)
(const :tag " doi: Links to DOI references" ol-doi)
(const :tag " eww: Store link to URL of Eww" ol-eww)
(const :tag " gnus: Links to GNUS folders/messages" ol-gnus)
(const :tag " habit: Track your consistency with habits" org-habit)
(const :tag " id: Global IDs for identifying entries" org-id)
(const :tag " info: Links to Info nodes" ol-info)
(const :tag " inlinetask: Tasks independent of outline hierarchy" org-inlinetask)
(const :tag " irc: Links to IRC/ERC chat sessions" ol-irc)
(const :tag " mhe: Links to MHE folders/messages" ol-mhe)
(const :tag " mouse: Additional mouse support" org-mouse)
(const :tag " protocol: Intercept calls from emacsclient" org-protocol)
(const :tag " rmail: Links to RMAIL folders/messages" ol-rmail)
(const :tag " tempo: Fast completion for structures" org-tempo)
(const :tag " w3m: Special cut/paste from w3m to Org mode." ol-w3m)
(const :tag " eshell: Links to working directories in Eshell" ol-eshell)
(const :tag "C annotate-file: Annotate a file with Org syntax" org-annotate-file)
(const :tag "C bookmark: Links to bookmarks" ol-bookmark)
(const :tag "C checklist: Extra functions for checklists in repeated tasks" org-checklist)
(const :tag "C choose: Use TODO keywords to mark decisions states" org-choose)
(const :tag "C collector: Collect properties into tables" org-collector)
(const :tag "C depend: TODO dependencies for Org mode\n\t\t\t(PARTIALLY OBSOLETE, see built-in dependency support))" org-depend)
(const :tag "C elisp-symbol: Links to emacs-lisp symbols" ol-elisp-symbol)
(const :tag "C eval-light: Evaluate inbuffer-code on demand" org-eval-light)
(const :tag "C eval: Include command output as text" org-eval)
(const :tag "C expiry: Expiry mechanism for Org entries" org-expiry)
(const :tag "C git-link: Links to specific file version" ol-git-link)
(const :tag "C interactive-query: Interactive modification of tags query\n\t\t\t(PARTIALLY OBSOLETE, see secondary filtering)" org-interactive-query)
(const :tag "C invoice: Help manage client invoices in Org mode" org-invoice)
(const :tag "C learn: SuperMemo's incremental learning algorithm" org-learn)
(const :tag "C mac-iCal: Imports events from iCal.app to the Emacs diary" org-mac-iCal)
(const :tag "C mac-link: Grab links and url from various mac Applications" org-mac-link)
(const :tag "C mairix: Hook mairix search into Org for different MUAs" org-mairix)
(const :tag "C man: Links to man pages in Org mode" ol-man)
(const :tag "C mew: Links to Mew folders/messages" ol-mew)
(const :tag "C notify: Notifications for Org mode" org-notify)
(const :tag "C notmuch: Provide Org links to notmuch searches or messages" ol-notmuch)
(const :tag "C panel: Simple routines for us with bad memory" org-panel)
(const :tag "C registry: A registry for Org links" org-registry)
(const :tag "C screen: Visit screen sessions through links" org-screen)
(const :tag "C screenshot: Take and manage screenshots in Org files" org-screenshot)
(const :tag "C secretary: Team management with Org" org-secretary)
(const :tag "C sqlinsert: Convert Org tables to SQL insertions" orgtbl-sqlinsert)
(const :tag "C toc: Table of contents for Org buffer" org-toc)
(const :tag "C track: Keep up with Org mode development" org-track)
(const :tag "C velocity Something like Notational Velocity for Org" org-velocity)
(const :tag "C vm: Links to VM folders/messages" ol-vm)
(const :tag "C wikinodes: CamelCase wiki-like links" org-wikinodes)
(const :tag "C wl: Links to Wanderlust folders/messages" ol-wl)
(repeat :tag "External packages" :inline t (symbol :tag "Package"))))
(defvar org-export-registered-backends) ; From ox.el.
(declare-function org-export-derived-backend-p "ox" (backend &rest backends))
(declare-function org-export-backend-name "ox" (backend) t)
(defcustom org-export-backends '(ascii html icalendar latex odt)
"List of export back-ends that should be always available.
If a description starts with <C>, the file is not part of Emacs and Org mode,
so loading it will require that you have properly installed org-contrib
package from NonGNU Emacs Lisp Package Archive
https://elpa.nongnu.org/nongnu/org-contrib.html
Unlike to `org-modules', libraries in this list will not be
loaded along with Org, but only once the export framework is
needed.
This variable needs to be set before org.el is loaded. If you
need to make a change while Emacs is running, use the customize
interface or run the following code, where VAL stands for the new
value of the variable, after updating it:
(progn
(setq org-export-registered-backends
(cl-remove-if-not
(lambda (backend)
(let ((name (org-export-backend-name backend)))
(or (memq name val)
(catch \\='parentp
(dolist (b val)
(and (org-export-derived-backend-p b name)
(throw \\='parentp t)))))))
org-export-registered-backends))
(let ((new-list (mapcar #\\='org-export-backend-name
org-export-registered-backends)))
(dolist (backend val)
(cond
((not (load (format \"ox-%s\" backend) t t))
(message \"Problems while trying to load export back-end \\=`%s\\='\"
backend))
((not (memq backend new-list)) (push backend new-list))))
(set-default \\='org-export-backends new-list)))
Adding a back-end to this list will also pull the back-end it
depends on, if any."
:group 'org
:group 'org-export
:version "26.1"
:package-version '(Org . "9.0")
:initialize 'custom-initialize-set
:set (lambda (var val)
(if (not (featurep 'ox)) (set-default-toplevel-value var val)
;; Any back-end not required anymore (not present in VAL and not
;; a parent of any back-end in the new value) is removed from the
;; list of registered back-ends.
(setq org-export-registered-backends
(cl-remove-if-not
(lambda (backend)
(let ((name (org-export-backend-name backend)))
(or (memq name val)
(catch 'parentp
(dolist (b val)
(and (org-export-derived-backend-p b name)
(throw 'parentp t)))))))
org-export-registered-backends))
;; Now build NEW-LIST of both new back-ends and required
;; parents.
(let ((new-list (mapcar #'org-export-backend-name
org-export-registered-backends)))
(dolist (backend val)
(cond
((not (load (format "ox-%s" backend) t t))
(message "Problems while trying to load export back-end `%s'"
backend))
((not (memq backend new-list)) (push backend new-list))))
;; Set VAR to that list with fixed dependencies.
(set-default-toplevel-value var new-list))))
:type '(set :greedy t
(const :tag " ascii Export buffer to ASCII format" ascii)
(const :tag " beamer Export buffer to Beamer presentation" beamer)
(const :tag " html Export buffer to HTML format" html)
(const :tag " icalendar Export buffer to iCalendar format" icalendar)
(const :tag " latex Export buffer to LaTeX format" latex)
(const :tag " man Export buffer to MAN format" man)
(const :tag " md Export buffer to Markdown format" md)
(const :tag " odt Export buffer to ODT format" odt)
(const :tag " org Export buffer to Org format" org)
(const :tag " texinfo Export buffer to Texinfo format" texinfo)
(const :tag "C confluence Export buffer to Confluence Wiki format" confluence)
(const :tag "C deck Export buffer to deck.js presentations" deck)
(const :tag "C freemind Export buffer to Freemind mindmap format" freemind)
(const :tag "C groff Export buffer to Groff format" groff)
(const :tag "C koma-letter Export buffer to KOMA Scrlttrl2 format" koma-letter)
(const :tag "C RSS 2.0 Export buffer to RSS 2.0 format" rss)
(const :tag "C s5 Export buffer to s5 presentations" s5)
(const :tag "C taskjuggler Export buffer to TaskJuggler format" taskjuggler)))
(eval-after-load 'ox
'(dolist (backend org-export-backends)
(condition-case nil (require (intern (format "ox-%s" backend)))
(error (message "Problems while trying to load export back-end `%s'"
backend)))))
(defcustom org-support-shift-select nil
"Non-nil means make shift-cursor commands select text when possible.
\\<org-mode-map>
In Emacs 23, when `shift-select-mode' is on, shifted cursor keys
start selecting a region, or enlarge regions started in this way.
In Org mode, in special contexts, these same keys are used for
other purposes, important enough to compete with shift selection.
Org tries to balance these needs by supporting `shift-select-mode'
outside these special contexts, under control of this variable.
The default of this variable is nil, to avoid confusing behavior. Shifted
cursor keys will then execute Org commands in the following contexts:
- on a headline, changing TODO state (left/right) and priority (up/down)
- on a time stamp, changing the time
- in a plain list item, changing the bullet type
- in a property definition line, switching between allowed values
- in the BEGIN line of a clock table (changing the time block).
- in a table, moving the cell in the specified direction.
Outside these contexts, the commands will throw an error.
When this variable is t and the cursor is not in a special
context, Org mode will support shift-selection for making and
enlarging regions. To make this more effective, the bullet
cycling will no longer happen anywhere in an item line, but only
if the cursor is exactly on the bullet.
If you set this variable to the symbol `always', then the keys
will not be special in headlines, property lines, item lines, and
table cells, to make shift selection work there as well. If this is
what you want, you can use the following alternative commands:
`\\[org-todo]' and `\\[org-priority]' \
to change TODO state and priority,
`\\[universal-argument] \\[universal-argument] \\[org-todo]' \
can be used to switch TODO sets,
`\\[org-ctrl-c-minus]' to cycle item bullet types,
and properties can be edited by hand or in column view.
However, when the cursor is on a timestamp, shift-cursor commands
will still edit the time stamp - this is just too good to give up."
:group 'org
:type '(choice
(const :tag "Never" nil)
(const :tag "When outside special context" t)
(const :tag "Everywhere except timestamps" always)))
(defcustom org-loop-over-headlines-in-active-region t
"Shall some commands act upon headlines in the active region?
When set to t, some commands will be performed in all headlines
within the active region.
When set to `start-level', some commands will be performed in all
headlines within the active region, provided that these headlines
are of the same level than the first one.
When set to a string, those commands will be performed on the
matching headlines within the active region. Such string must be
a tags/property/todo match as it is used in the agenda tags view.
The list of commands is: `org-schedule', `org-deadline',
`org-todo', `org-set-tags-command', `org-archive-subtree',
`org-archive-set-tag', `org-toggle-archive-tag' and
`org-archive-to-archive-sibling'. The archiving commands skip
already archived entries.
See `org-agenda-loop-over-headlines-in-active-region' for the
equivalent option for agenda views."
:type '(choice (const :tag "Don't loop" nil)
(const :tag "All headlines in active region" t)
(const :tag "In active region, headlines at the same level than the first one" start-level)
(string :tag "Tags/Property/Todo matcher"))
:package-version '(Org . "9.4")
:group 'org-todo
:group 'org-archive)
(defgroup org-startup nil
"Startup options Org uses when first visiting a file."
:tag "Org Startup"
:group 'org)
(defcustom org-startup-folded 'showeverything
"Non-nil means entering Org mode will switch to OVERVIEW.
This can also be configured on a per-file basis by adding one of
the following lines anywhere in the buffer:
#+STARTUP: fold (or `overview', this is equivalent)
#+STARTUP: nofold (or `showall', this is equivalent)
#+STARTUP: content
#+STARTUP: show<n>levels (<n> = 2..5)
#+STARTUP: showeverything
Set `org-agenda-inhibit-startup' to a non-nil value if you want
to ignore this option when Org opens agenda files for the first
time."
:group 'org-startup
:package-version '(Org . "9.4")
:type '(choice
(const :tag "nofold: show all" nil)
(const :tag "fold: overview" t)
(const :tag "fold: show two levels" show2levels)
(const :tag "fold: show three levels" show3levels)
(const :tag "fold: show four levels" show4evels)
(const :tag "fold: show five levels" show5levels)
(const :tag "content: all headlines" content)
(const :tag "show everything, even drawers" showeverything)))
(defcustom org-startup-truncated t
"Non-nil means entering Org mode will set `truncate-lines'.
This is useful since some lines containing links can be very long and
uninteresting. Also tables look terrible when wrapped.
The variable `org-startup-truncated' allows to configure
truncation for Org mode different to the other modes that use the
variable `truncate-lines' and as a shortcut instead of putting
the variable `truncate-lines' into the `org-mode-hook'. If one
wants to configure truncation for Org mode not statically but
dynamically e.g. in a hook like `ediff-prepare-buffer-hook' then
the variable `truncate-lines' has to be used because in such a
case it is too late to set the variable `org-startup-truncated'."
:group 'org-startup
:type 'boolean)
(defcustom org-startup-indented nil
"Non-nil means turn on `org-indent-mode' on startup.
This can also be configured on a per-file basis by adding one of
the following lines anywhere in the buffer:
#+STARTUP: indent
#+STARTUP: noindent"
:group 'org-structure
:type '(choice
(const :tag "Not" nil)
(const :tag "Globally (slow on startup in large files)" t)))
(defcustom org-startup-numerated nil
"Non-nil means turn on `org-num-mode' on startup.
This can also be configured on a per-file basis by adding one of
the following lines anywhere in the buffer:
#+STARTUP: num
#+STARTUP: nonum"
:group 'org-structure
:package-version '(Org . "9.4")
:type '(choice
(const :tag "Not" nil)
(const :tag "Globally" t)))
(defcustom org-use-sub-superscripts t
"Non-nil means interpret \"_\" and \"^\" for display.
If you want to control how Org exports those characters, see
`org-export-with-sub-superscripts'.
When this option is turned on, you can use TeX-like syntax for
sub- and superscripts within the buffer. Several characters after
\"_\" or \"^\" will be considered as a single item - so grouping
with {} is normally not needed. For example, the following things
will be parsed as single sub- or superscripts:
10^24 or 10^tau several digits will be considered 1 item.
10^-12 or 10^-tau a leading sign with digits or a word
x^2-y^3 will be read as x^2 - y^3, because items are
terminated by almost any nonword/nondigit char.
x_{i^2} or x^(2-i) braces or parenthesis do grouping.
Still, ambiguity is possible. So when in doubt, use {} to enclose
the sub/superscript. If you set this variable to the symbol `{}',
the braces are *required* in order to trigger interpretations as
sub/superscript. This can be helpful in documents that need \"_\"
frequently in plain text."
:group 'org-startup
:version "24.4"
:package-version '(Org . "8.0")
:type '(choice
(const :tag "Always interpret" t)
(const :tag "Only with braces" {})
(const :tag "Never interpret" nil)))
(defcustom org-startup-with-beamer-mode nil
"Non-nil means turn on `org-beamer-mode' on startup.
This can also be configured on a per-file basis by adding one of
the following lines anywhere in the buffer:
#+STARTUP: beamer"
:group 'org-startup
:version "24.1"
:type 'boolean)
(defcustom org-startup-align-all-tables nil
"Non-nil means align all tables when visiting a file.
This can also be configured on a per-file basis by adding one of
the following lines anywhere in the buffer:
#+STARTUP: align
#+STARTUP: noalign"
:group 'org-startup
:type 'boolean)
(defcustom org-startup-shrink-all-tables nil
"Non-nil means shrink all table columns with a width cookie.
This can also be configured on a per-file basis by adding one of
the following lines anywhere in the buffer:
#+STARTUP: shrink"
:group 'org-startup
:type 'boolean
:version "27.1"
:package-version '(Org . "9.2")
:safe #'booleanp)
(defcustom org-startup-with-inline-images nil
"Non-nil means show inline images when loading a new Org file.
This can also be configured on a per-file basis by adding one of
the following lines anywhere in the buffer:
#+STARTUP: inlineimages
#+STARTUP: noinlineimages"
:group 'org-startup
:version "24.1"
:type 'boolean)
(defcustom org-startup-with-latex-preview nil
"Non-nil means preview LaTeX fragments when loading a new Org file.
This can also be configured on a per-file basis by adding one of
the following lines anywhere in the buffer:
#+STARTUP: latexpreview
#+STARTUP: nolatexpreview"
:group 'org-startup
:version "24.4"
:package-version '(Org . "8.0")
:type 'boolean)
(defcustom org-insert-mode-line-in-empty-file nil
"Non-nil means insert the first line setting Org mode in empty files.
When the function `org-mode' is called interactively in an empty file, this
normally means that the file name does not automatically trigger Org mode.
To ensure that the file will always be in Org mode in the future, a
line enforcing Org mode will be inserted into the buffer, if this option
has been set."
:group 'org-startup
:type 'boolean)
(defcustom org-ellipsis nil
"The ellipsis to use in the Org mode outline.
When nil, just use the standard three dots. When a non-empty string,
use that string instead.
The change affects only Org mode (which will then use its own display table).
Changing this requires executing `\\[org-mode]' in a buffer to become
effective. It cannot be set as a local variable."
:group 'org-startup
:type '(choice (const :tag "Default" nil)
(string :tag "String" :value "...#")))
(defvar org-display-table nil
"The display table for Org mode, in case `org-ellipsis' is non-nil.")
(defcustom org-directory "~/org"
"Directory with Org files.
This is just a default location to look for Org files. There is no need
at all to put your files into this directory. It is used in the
following situations:
1. When a capture template specifies a target file that is not an
absolute path. The path will then be interpreted relative to
`org-directory'
2. When the value of variable `org-agenda-files' is a single file, any
relative paths in this file will be taken as relative to
`org-directory'."
:group 'org-refile
:group 'org-capture
:type 'directory)
(defcustom org-default-notes-file (convert-standard-filename "~/.notes")
"Default target for storing notes.
Used as a fall back file for org-capture.el, for templates that
do not specify a target file."
:group 'org-refile
:group 'org-capture
:type 'file)
(defcustom org-reverse-note-order nil
"Non-nil means store new notes at the beginning of a file or entry.
When nil, new notes will be filed to the end of a file or entry.
This can also be a list with cons cells of regular expressions that
are matched against file names, and values."
:group 'org-capture
:group 'org-refile
:type '(choice
(const :tag "Reverse always" t)
(const :tag "Reverse never" nil)
(repeat :tag "By file name regexp"
(cons regexp boolean))))
(defgroup org-keywords nil
"Keywords in Org mode."
:tag "Org Keywords"
:group 'org)
(defcustom org-closed-keep-when-no-todo nil
"Remove CLOSED: time-stamp when switching back to a non-todo state?"
:group 'org-todo
:group 'org-keywords
:version "24.4"
:package-version '(Org . "8.0")
:type 'boolean)
(defgroup org-structure nil
"Options concerning the general structure of Org files."
:tag "Org Structure"
:group 'org)
(defcustom org-indirect-buffer-display 'other-window
"How should indirect tree buffers be displayed?
This applies to indirect buffers created with the commands
`org-tree-to-indirect-buffer' and `org-agenda-tree-to-indirect-buffer'.
Valid values are:
current-window Display in the current window
other-window Just display in another window.
dedicated-frame Create one new frame, and re-use it each time.
new-frame Make a new frame each time. Note that in this case
previously-made indirect buffers are kept, and you need to
kill these buffers yourself."
:group 'org-structure
:group 'org-agenda-windows
:type '(choice
(const :tag "In current window" current-window)
(const :tag "In current frame, other window" other-window)
(const :tag "Each time a new frame" new-frame)
(const :tag "One dedicated frame" dedicated-frame)))
(defconst org-file-apps-gnu
'((remote . emacs)
(system . mailcap)
(t . mailcap))
"Default file applications on a UNIX or GNU/Linux system.
See `org-file-apps'.")
(defconst org-file-apps-macos
'((remote . emacs)
(system . "open %s")
("ps.gz" . "gv %s")
("eps.gz" . "gv %s")
("dvi" . "xdvi %s")
("fig" . "xfig %s")
(t . "open %s"))
"Default file applications on a macOS system.
The system \"open\" is known as a default, but we use X11 applications
for some files for which the OS does not have a good default.
See `org-file-apps'.")
(defconst org-file-apps-windowsnt
(list '(remote . emacs)
(cons 'system (lambda (file _path)
(with-no-warnings (w32-shell-execute "open" file))))
(cons t (lambda (file _path)
(with-no-warnings (w32-shell-execute "open" file)))))
"Default file applications on a Windows NT system.
The system \"open\" is used for most files.
See `org-file-apps'.")
(defcustom org-file-apps
'((auto-mode . emacs)
(directory . emacs)
("\\.mm\\'" . default)
("\\.x?html?\\'" . default)
("\\.pdf\\'" . default))
"Applications for opening `file:path' items in a document.
\\<org-mode-map>
Org mode uses system defaults for different file types, but you
can use this variable to set the application for a given file
extension. The entries in this list are cons cells where the car
identifies files and the cdr the corresponding command.
Possible values for the file identifier are:
\"string\" A string as a file identifier can be interpreted in different
ways, depending on its contents:
- Alphanumeric characters only:
Match links with this file extension.
Example: (\"pdf\" . \"evince %s\")
to open PDFs with evince.
- Regular expression: Match links where the
filename matches the regexp. If you want to
use groups here, use shy groups.
Example: (\"\\\\.x?html\\\\\\='\" . \"firefox %s\")
(\"\\\\(?:xhtml\\\\|html\\\\)\\\\\\='\" . \"firefox %s\")
to open *.html and *.xhtml with firefox.
- Regular expression which contains (non-shy) groups:
Match links where the whole link, including \"::\", and
anything after that, matches the regexp.
In a custom command string, %1, %2, etc. are replaced with
the parts of the link that were matched by the groups.
For backwards compatibility, if a command string is given
that does not use any of the group matches, this case is
handled identically to the second one (i.e. match against
file name only).
In a custom function, you can access the group matches with
(match-string n link).
Example: (\"\\\\.pdf::\\\\([0-9]+\\\\)\\\\\\='\" . \
\"evince -p %1 %s\")
to open [[file:document.pdf::5]] with evince at page 5.
Likely, you will need more entries: without page
number; with search pattern; with cross-reference
anchor; some combination of options. Consider simple
pattern here and a Lisp function to determine command
line arguments instead. Passing argument list to
`call-process' or `make-process' directly allows to
avoid treating some character in peculiar file names
as shell specialls causing executing part of file
name as a subcommand.
`directory' Matches a directory
`remote' Matches a remote file, accessible through tramp.
Remote files most likely should be visited through Emacs
because external applications cannot handle such paths.
`auto-mode' Matches files that are matched by any entry in `auto-mode-alist',
so all files Emacs knows how to handle. Using this with
command `emacs' will open most files in Emacs. Beware that this
will also open html files inside Emacs, unless you add
(\"html\" . default) to the list as well.
`system' The system command to open files, like `open' on Windows
and macOS, and mailcap under GNU/Linux. This is the command
that will be selected if you call `org-open-at-point' with a
double prefix argument (`\\[universal-argument] \
\\[universal-argument] \\[org-open-at-point]').
t Default for files not matched by any of the other options.
Possible values for the command are:
`emacs' The file will be visited by the current Emacs process.
`default' Use the default application for this file type, which is the
association for t in the list, most likely in the system-specific
part. This can be used to overrule an unwanted setting in the
system-specific variable.
`system' Use the system command for opening files, like \"open\".
This command is specified by the entry whose car is `system'.
Most likely, the system-specific version of this variable
does define this command, but you can overrule/replace it
here.
`mailcap' Use command specified in the mailcaps.
string A command to be executed by a shell; %s will be replaced
by the path to the file.
function A Lisp function, which will be called with two arguments:
the file path and the original link string, without the
\"file:\" prefix.
For more examples, see the system specific constants
`org-file-apps-macos'
`org-file-apps-windowsnt'
`org-file-apps-gnu'."
:group 'org
:package-version '(Org . "9.4")
:type '(repeat
(cons (choice :value ""
(string :tag "Extension")
(const :tag "System command to open files" system)
(const :tag "Default for unrecognized files" t)
(const :tag "Remote file" remote)
(const :tag "Links to a directory" directory)
(const :tag "Any files that have Emacs modes"
auto-mode))
(choice :value ""
(const :tag "Visit with Emacs" emacs)
(const :tag "Use default" default)
(const :tag "Use the system command" system)
(string :tag "Command")
(function :tag "Function")))))
(defcustom org-resource-download-policy 'prompt
"The policy applied to requests to obtain remote resources.
This affects keywords like #+setupfile and #+include on export,
`org-persist-write:url',and `org-attach-url' in non-interactive
Emacs sessions.
This recognizes four possible values:
- t, remote resources should always be downloaded.
- prompt, you will be prompted to download resources not considered safe.
- safe, only resources considered safe will be downloaded.
- nil, never download remote resources.
A resource is considered safe if it matches one of the patterns
in `org-safe-remote-resources'."
:group 'org
:package-version '(Org . "9.6")
:type '(choice (const :tag "Always download remote resources" t)
(const :tag "Prompt before downloading an unsafe resource" prompt)
(const :tag "Only download resources considered safe" safe)
(const :tag "Never download any resources" nil)))
(defcustom org-safe-remote-resources nil
"A list of regexp patterns matching safe URIs.
URI regexps are applied to both URLs and Org files requesting
remote resources."
:group 'org
:package-version '(Org . "9.6")
:type '(repeat regexp))
(defcustom org-open-non-existing-files nil
"Non-nil means `org-open-file' opens non-existing files.
When nil, an error is thrown.
This variable applies only to external applications because they
might choke on non-existing files. If the link is to a file that
will be opened in Emacs, the variable is ignored."
:group 'org
:type 'boolean
:safe #'booleanp)
(defcustom org-open-directory-means-index-dot-org nil
"When non-nil a link to a directory really means to \"index.org\".
When nil, following a directory link runs Dired or opens
a finder/explorer window on that directory."
:group 'org
:type 'boolean
:safe #'booleanp)
(defcustom org-bookmark-names-plist
'(:last-capture "org-capture-last-stored"
:last-refile "org-refile-last-stored"
:last-capture-marker "org-capture-last-stored-marker")
"Names for bookmarks automatically set by some Org commands.
This can provide strings as names for a number of bookmarks Org sets
automatically. The following keys are currently implemented:
:last-capture
:last-capture-marker
:last-refile
When a key does not show up in the property list, the corresponding bookmark
is not set."
:group 'org-structure
:type 'plist)
(defgroup org-edit-structure nil
"Options concerning structure editing in Org mode."
:tag "Org Edit Structure"
:group 'org-structure)
(defcustom org-odd-levels-only nil
"Non-nil means skip even levels and only use odd levels for the outline.
This has the effect that two stars are being added/taken away in
promotion/demotion commands. It also influences how levels are
handled by the exporters.
Changing it requires restart of `font-lock-mode' to become effective
for fontification also in regions already fontified.
You may also set this on a per-file basis by adding one of the following
lines to the buffer:
#+STARTUP: odd
#+STARTUP: oddeven"
:group 'org-edit-structure
:group 'org-appearance
:type 'boolean)
(defcustom org-adapt-indentation nil
"Non-nil means adapt indentation to outline node level.
When set to t, Org assumes that you write outlines by indenting
text in each node to align with the headline, after the stars.
When this variable is set to `headline-data', Org only adapts the
indentation of the data lines right below the headline, such as
planning/clock lines and property/logbook drawers.
The following issues are influenced by this variable:
- The indentation is increased by one space in a demotion
command, and decreased by one in a promotion command. However,
in the latter case, if shifting some line in the entry body
would alter document structure (e.g., insert a new headline),
indentation is not changed at all.
- Property drawers and planning information is inserted indented
when this variable is set. When nil, they will not be indented.
- TAB indents a line relative to current level. The lines below
a headline will be indented when this variable is set to t.
Note that this is all about true indentation, by adding and
removing space characters. See also \"org-indent.el\" which does
level-dependent indentation in a virtual way, i.e. at display
time in Emacs."
:group 'org-edit-structure
:type '(choice
(const :tag "Adapt indentation for all lines" t)
(const :tag "Adapt indentation for headline data lines"
headline-data)
(const :tag "Do not adapt indentation at all" nil))
:safe (lambda (x) (memq x '(t nil headline-data))))
(defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e)
(defcustom org-special-ctrl-a/e nil
"Non-nil means `C-a' and `C-e' behave specially in headlines and items.
When t, `C-a' will bring back the cursor to the beginning of the
headline text, i.e. after the stars and after a possible TODO
keyword. In an item, this will be the position after bullet and
check-box, if any. When the cursor is already at that position,
another `C-a' will bring it to the beginning of the line.
`C-e' will jump to the end of the headline, ignoring the presence
of tags in the headline. A second `C-e' will then jump to the
true end of the line, after any tags. This also means that, when
this variable is non-nil, `C-e' also will never jump beyond the
end of the heading of a folded section, i.e. not after the
ellipses.
When set to the symbol `reversed', the first `C-a' or `C-e' works
normally, going to the true line boundary first. Only a directly
following, identical keypress will bring the cursor to the
special positions.
This may also be a cons cell where the behavior for `C-a' and
`C-e' is set separately."
:group 'org-edit-structure
:type '(choice
(const :tag "off" nil)
(const :tag "on: after stars/bullet and before tags first" t)
(const :tag "reversed: true line boundary first" reversed)
(cons :tag "Set C-a and C-e separately"
(choice :tag "Special C-a"
(const :tag "off" nil)
(const :tag "on: after stars/bullet first" t)
(const :tag "reversed: before stars/bullet first" reversed))
(choice :tag "Special C-e"
(const :tag "off" nil)
(const :tag "on: before tags first" t)
(const :tag "reversed: after tags first" reversed)))))
(defcustom org-special-ctrl-k nil
"Non-nil means that \\<org-mode-map>\\[org-kill-line] \
will behave specially in headlines.
When nil, \\[org-kill-line] will call the default `kill-line' command.
Otherwise, the following will happen when point is in a headline:
- At the beginning of a headline, kill the entire line.
- In the middle of the headline text, kill the text up to the tags.
- After the headline text and before the tags, kill all the tags."
:group 'org-edit-structure
:type 'boolean)
(defcustom org-ctrl-k-protect-subtree nil
"Non-nil means, do not delete a hidden subtree with `C-k'.
When set to the symbol `error', simply throw an error when `C-k' is
used to kill (part-of) a headline that has hidden text behind it.
Any other non-nil value will result in a query to the user, if it is
OK to kill that hidden subtree. When nil, kill without remorse."
:group 'org-edit-structure
:version "24.1"
:type '(choice
(const :tag "Do not protect hidden subtrees" nil)
(const :tag "Protect hidden subtrees with a security query" t)
(const :tag "Never kill a hidden subtree with C-k" error)))
(defcustom org-special-ctrl-o t
"Non-nil means, make `open-line' (\\[open-line]) insert a row in tables."
:group 'org-edit-structure
:type 'boolean)
(defcustom org-yank-folded-subtrees t
"Non-nil means when yanking subtrees, fold them.
If the kill is a single subtree, or a sequence of subtrees, i.e. if
it starts with a heading and all other headings in it are either children
or siblings, then fold all the subtrees. However, do this only if no
text after the yank would be swallowed into a folded tree by this action."
:group 'org-edit-structure
:type 'boolean)
(defcustom org-yank-adjusted-subtrees nil
"Non-nil means when yanking subtrees, adjust the level.
With this setting, `org-paste-subtree' is used to insert the subtree, see
this function for details."
:group 'org-edit-structure
:type 'boolean)
(defcustom org-M-RET-may-split-line '((default . t))
"Non-nil means M-RET will split the line at the cursor position.
When nil, it will go to the end of the line before making a
new line.
You may also set this option in a different way for different
contexts. Valid contexts are:
headline when creating a new headline
item when creating a new item
table in a table field
default the value to be used for all contexts not explicitly
customized"
:group 'org-structure
:group 'org-table
:type '(choice
(const :tag "Always" t)
(const :tag "Never" nil)
(repeat :greedy t :tag "Individual contexts"
(cons
(choice :tag "Context"
(const headline)
(const item)
(const table)
(const default))
(boolean)))))
(defcustom org-insert-heading-respect-content nil
"Non-nil means insert new headings after the current subtree.
\\<org-mode-map>
When nil, the new heading is created directly after the current line.
The commands `\\[org-insert-heading-respect-content]' and \
`\\[org-insert-todo-heading-respect-content]' turn this variable on
for the duration of the command."
:group 'org-structure
:type 'boolean)
(defcustom org-blank-before-new-entry '((heading . auto)
(plain-list-item . auto))
"Should `org-insert-heading' leave a blank line before new heading/item?
The value is an alist, with `heading' and `plain-list-item' as CAR,
and a boolean flag as CDR. The cdr may also be the symbol `auto', in
which case Org will look at the surrounding headings/items and try to
make an intelligent decision whether to insert a blank line or not."
:group 'org-edit-structure
:type '(list
(cons (const heading)
(choice (const :tag "Never" nil)
(const :tag "Always" t)
(const :tag "Auto" auto)))
(cons (const plain-list-item)
(choice (const :tag "Never" nil)
(const :tag "Always" t)
(const :tag "Auto" auto)))))
(defcustom org-insert-heading-hook nil
"Hook being run after inserting a new heading."
:group 'org-edit-structure
:type 'hook)
(defgroup org-sparse-trees nil
"Options concerning sparse trees in Org mode."
:tag "Org Sparse Trees"
:group 'org-structure)
(defcustom org-highlight-sparse-tree-matches t
"Non-nil means highlight all matches that define a sparse tree.
The highlights will automatically disappear the next time the buffer is
changed by an edit command."
:group 'org-sparse-trees
:type 'boolean)
(defcustom org-remove-highlights-with-change t
"Non-nil means any change to the buffer will remove temporary highlights.
\\<org-mode-map>\
Such highlights are created by `org-occur' and `org-clock-display'.
When nil, `\\[org-ctrl-c-ctrl-c]' needs to be used \
to get rid of the highlights.
The highlights created by `org-latex-preview' always need
`\\[org-latex-preview]' to be removed."
:group 'org-sparse-trees
:group 'org-time
:type 'boolean)
(defcustom org-occur-case-fold-search t
"Non-nil means `org-occur' should be case-insensitive.
If set to `smart' the search will be case-insensitive only if it
doesn't specify any upper case character."
:group 'org-sparse-trees
:version "26.1"
:type '(choice
(const :tag "Case-sensitive" nil)
(const :tag "Case-insensitive" t)
(const :tag "Case-insensitive for lower case searches only" smart)))
(defcustom org-occur-hook '(org-first-headline-recenter)
"Hook that is run after `org-occur' has constructed a sparse tree.
This can be used to recenter the window to show as much of the structure
as possible."
:group 'org-sparse-trees
:type 'hook)
(defcustom org-self-insert-cluster-for-undo nil
"Non-nil means cluster self-insert commands for undo when possible.
If this is set, then, like in the Emacs command loop, 20 consecutive
characters will be undone together.
This is configurable, because there is some impact on typing performance."
:group 'org-table
:type 'boolean)
(defvaralias 'org-activate-links 'org-highlight-links)
(defcustom org-highlight-links '(bracket angle plain radio tag date footnote)
"Types of links that should be highlighted in Org files.
This is a list of symbols, each one of them leading to the
highlighting of a certain link type.
You can still open links that are not highlighted.
In principle, it does not hurt to turn on highlighting for all
link types. There may be a small gain when turning off unused
link types. The types are:
bracket The recommended [[link][description]] or [[link]] links with hiding.
angle Links in angular brackets that may contain whitespace like
<bbdb:Carsten Dominik>.
plain Plain links in normal text, no whitespace, like https://gnu.org.
radio Text that is matched by a radio target, see manual for details.
tag Tag settings in a headline (link to tag search).
date Time stamps (link to calendar).
footnote Footnote labels.
If you set this variable during an Emacs session, use `org-mode-restart'
in the Org buffer so that the change takes effect."
:group 'org-appearance
:type '(set :greedy t
(const :tag "Double bracket links" bracket)
(const :tag "Angular bracket links" angle)
(const :tag "Plain text links" plain)
(const :tag "Radio target matches" radio)
(const :tag "Tags" tag)
(const :tag "Timestamps" date)
(const :tag "Footnotes" footnote)))
(defcustom org-mark-ring-length 4
"Number of different positions to be recorded in the ring.
Changing this requires a restart of Emacs to work correctly."
:group 'org-link-follow
:type 'integer)
(defgroup org-todo nil
"Options concerning TODO items in Org mode."
:tag "Org TODO"
:group 'org)
(defgroup org-progress nil
"Options concerning Progress logging in Org mode."
:tag "Org Progress"
:group 'org-time)
(defvar org-todo-interpretation-widgets
'((:tag "Sequence (cycling hits every state)" sequence)
(:tag "Type (cycling directly to DONE)" type))
"The available interpretation symbols for customizing `org-todo-keywords'.
Interested libraries should add to this list.")
(defcustom org-todo-keywords '((sequence "TODO" "DONE"))
"List of TODO entry keyword sequences and their interpretation.
\\<org-mode-map>This is a list of sequences.
Each sequence starts with a symbol, either `sequence' or `type',
indicating if the keywords should be interpreted as a sequence of
action steps, or as different types of TODO items. The first
keywords are states requiring action - these states will select a headline
for inclusion into the global TODO list Org produces. If one of the
\"keywords\" is the vertical bar, \"|\", the remaining keywords
signify that no further action is necessary. If \"|\" is not found,
the last keyword is treated as the only DONE state of the sequence.
The command `\\[org-todo]' cycles an entry through these states, and one
additional state where no keyword is present. For details about this
cycling, see the manual.
TODO keywords and interpretation can also be set on a per-file basis with
the special #+SEQ_TODO and #+TYP_TODO lines.
Each keyword can optionally specify a character for fast state selection
\(in combination with the variable `org-use-fast-todo-selection')
and specifiers for state change logging, using the same syntax that
is used in the \"#+TODO:\" lines. For example, \"WAIT(w)\" says that
the WAIT state can be selected with the \"w\" key. \"WAIT(w!)\"
indicates to record a time stamp each time this state is selected.
Each keyword may also specify if a timestamp or a note should be
recorded when entering or leaving the state, by adding additional
characters in the parenthesis after the keyword. This looks like this:
\"WAIT(w@/!)\". \"@\" means to add a note (with time), \"!\" means to
record only the time of the state change. With X and Y being either
\"@\" or \"!\", \"X/Y\" means use X when entering the state, and use
Y when leaving the state if and only if the *target* state does not
define X. You may omit any of the fast-selection key or X or /Y,
so WAIT(w@), WAIT(w/@) and WAIT(@/@) are all valid.
For backward compatibility, this variable may also be just a list
of keywords. In this case the interpretation (sequence or type) will be
taken from the (otherwise obsolete) variable `org-todo-interpretation'."
:group 'org-todo
:group 'org-keywords
:type '(choice
(repeat :tag "Old syntax, just keywords"
(string :tag "Keyword"))
(repeat :tag "New syntax"
(cons
(choice
:tag "Interpretation"
;;Quick and dirty way to see
;;`org-todo-interpretation'. This takes the
;;place of item arguments
:convert-widget
(lambda (widget)
(widget-put widget
:args (mapcar
(lambda (x)
(widget-convert
(cons 'const x)))
org-todo-interpretation-widgets))
widget))
(repeat
(string :tag "Keyword"))))))
(defvar-local org-todo-keywords-1 nil
"All TODO and DONE keywords active in a buffer.")
(defvar org-todo-keywords-for-agenda nil)
(defvar org-done-keywords-for-agenda nil)
(defvar org-todo-keyword-alist-for-agenda nil)
(defvar org-tag-alist-for-agenda nil
"Alist of all tags from all agenda files.")
(defvar org-tag-groups-alist-for-agenda nil
"Alist of all groups tags from all current agenda files.")
(defvar-local org-tag-groups-alist nil)
(defvar org-agenda-contributing-files nil)
(defvar-local org-current-tag-alist nil
"Alist of all tag groups in current buffer.
This variable takes into consideration `org-tag-alist',
`org-tag-persistent-alist' and TAGS keywords in the buffer.")
(defvar-local org-not-done-keywords nil)
(defvar-local org-done-keywords nil)
(defvar-local org-todo-heads nil)
(defvar-local org-todo-sets nil)
(defvar-local org-todo-log-states nil)
(defvar-local org-todo-kwd-alist nil)
(defvar-local org-todo-key-alist nil)
(defvar-local org-todo-key-trigger nil)
(defcustom org-todo-interpretation 'sequence
"Controls how TODO keywords are interpreted.
This variable is in principle obsolete and is only used for
backward compatibility, if the interpretation of todo keywords is
not given already in `org-todo-keywords'. See that variable for
more information."
:group 'org-todo
:group 'org-keywords
:type '(choice (const sequence)
(const type)))
(defcustom org-use-fast-todo-selection 'auto
"\\<org-mode-map>\
Non-nil means use the fast todo selection scheme with `\\[org-todo]'.
This variable describes if and under what circumstances the cycling
mechanism for TODO keywords will be replaced by a single-key, direct
selection scheme, where the choices are displayed in a little window.
When nil, fast selection is never used. This means that the command
will always switch to the next state.
When it is the symbol `auto', fast selection is whenever selection
keys have been defined.
`expert' is like `auto', but no special window with the keyword
will be shown, choices will only be listed in the prompt.
In all cases, the special interface is only used if access keys have
actually been assigned by the user, i.e. if keywords in the configuration
are followed by a letter in parenthesis, like TODO(t)."
:group 'org-todo
:set (lambda (var val)
(cond
((eq var t) (set-default-toplevel-value var 'auto))
((eq var 'prefix) (set-default-toplevel-value var nil))
(t (set-default-toplevel-value var val))))
:type '(choice
(const :tag "Never" nil)
(const :tag "Automatically, when key letter have been defined" auto)
(const :tag "Automatically, but don't show the selection window" expert)))
(defcustom org-provide-todo-statistics t
"Non-nil means update todo statistics after insert and toggle.
ALL-HEADLINES means update todo statistics by including headlines
with no TODO keyword as well, counting them as not done.
A list of TODO keywords means the same, but skip keywords that are
not in this list.
When set to a list of two lists, the first list contains keywords
to consider as TODO keywords, the second list contains keywords
to consider as DONE keywords.
When this is set, todo statistics is updated in the parent of the
current entry each time a todo state is changed."
:group 'org-todo
:type '(choice
(const :tag "Yes, only for TODO entries" t)
(const :tag "Yes, including all entries" all-headlines)
(repeat :tag "Yes, for TODOs in this list"
(string :tag "TODO keyword"))
(list :tag "Yes, for TODOs and DONEs in these lists"
(repeat (string :tag "TODO keyword"))
(repeat (string :tag "DONE keyword")))
(other :tag "No TODO statistics" nil)))
(defcustom org-hierarchical-todo-statistics t
"Non-nil means TODO statistics covers just direct children.
When nil, all entries in the subtree are considered.
This has only an effect if `org-provide-todo-statistics' is set.
To set this to nil for only a single subtree, use a COOKIE_DATA
property and include the word \"recursive\" into the value."
:group 'org-todo
:type 'boolean)
(defcustom org-after-todo-state-change-hook nil
"Hook which is run after the state of a TODO item was changed.
The new state (a string with a TODO keyword, or nil) is available in the
Lisp variable `org-state'."
:group 'org-todo
:type 'hook)
(defvar org-blocker-hook nil
"Hook for functions that are allowed to block a state change.
Functions in this hook should not modify the buffer.
Each function gets as its single argument a property list,
see `org-trigger-hook' for more information about this list.
If any of the functions in this hook returns nil, the state change
is blocked.")
(defvar org-trigger-hook nil
"Hook for functions that are triggered by a state change.
Each function gets as its single argument a property list with at
least the following elements:
(:type type-of-change :position pos-at-entry-start
:from old-state :to new-state)
Depending on the type, more properties may be present.
This mechanism is currently implemented for:
TODO state changes
------------------
:type todo-state-change
:from previous state (keyword as a string), or nil, or a symbol
`todo' or `done', to indicate the general type of state.
:to new state, like in :from")
(defcustom org-enforce-todo-dependencies nil
"Non-nil means undone TODO entries will block switching the parent to DONE.
Also, if a parent has an :ORDERED: property, switching an entry to DONE will
be blocked if any prior sibling is not yet done.
Finally, if the parent is blocked because of ordered siblings of its own,
the child will also be blocked."
:set (lambda (var val)
(set-default-toplevel-value var val)
(if val
(add-hook 'org-blocker-hook
'org-block-todo-from-children-or-siblings-or-parent)
(remove-hook 'org-blocker-hook
'org-block-todo-from-children-or-siblings-or-parent)))
:group 'org-todo
:type 'boolean)
(defcustom org-enforce-todo-checkbox-dependencies nil
"Non-nil means unchecked boxes will block switching the parent to DONE.
When this is nil, checkboxes have no influence on switching TODO states.
When non-nil, you first need to check off all check boxes before the TODO
entry can be switched to DONE.
This variable needs to be set before org.el is loaded, and you need to
restart Emacs after a change to make the change effective. The only way
to change it while Emacs is running is through the customize interface."
:set (lambda (var val)
(set-default-toplevel-value var val)
(if val
(add-hook 'org-blocker-hook
'org-block-todo-from-checkboxes)
(remove-hook 'org-blocker-hook
'org-block-todo-from-checkboxes)))
:group 'org-todo
:type 'boolean)
(defcustom org-treat-insert-todo-heading-as-state-change nil
"Non-nil means inserting a TODO heading is treated as state change.
So when the command `\\[org-insert-todo-heading]' is used, state change
logging will apply if appropriate. When nil, the new TODO item will
be inserted directly, and no logging will take place."
:group 'org-todo
:type 'boolean)
(defcustom org-treat-S-cursor-todo-selection-as-state-change t
"Non-nil means switching TODO states with S-cursor counts as state change.
This is the default behavior. However, setting this to nil allows a
convenient way to select a TODO state and bypass any logging associated
with that."
:group 'org-todo
:type 'boolean)
(defcustom org-todo-state-tags-triggers nil
"Tag changes that should be triggered by TODO state changes.
This is a list. Each entry is
(state-change (tag . flag) .......)
State-change can be a string with a state, and empty string to indicate the
state that has no TODO keyword, or it can be one of the symbols `todo'
or `done', meaning any not-done or done state, respectively."
:group 'org-todo
:group 'org-tags
:type '(repeat
(cons (choice :tag "When changing to"
(const :tag "Not-done state" todo)
(const :tag "Done state" done)
(string :tag "State"))
(repeat
(cons :tag "Tag action"
(string :tag "Tag")
(choice (const :tag "Add" t) (const :tag "Remove" nil)))))))
(defcustom org-log-done nil
"Information to record when a task moves to the DONE state.
Possible values are:
nil Don't add anything, just change the keyword
time Add a time stamp to the task
note Prompt for a note and add it with template `org-log-note-headings'
This option can also be set with on a per-file-basis with
#+STARTUP: nologdone
#+STARTUP: logdone
#+STARTUP: lognotedone
You can have local logging settings for a subtree by setting the LOGGING
property to one or more of these keywords."
:group 'org-todo
:group 'org-progress
:type '(choice
(const :tag "No logging" nil)
(const :tag "Record CLOSED timestamp" time)
(const :tag "Record CLOSED timestamp with note." note)))
;; Normalize old uses of org-log-done.
(cond
((eq org-log-done t) (setq org-log-done 'time))
((and (listp org-log-done) (memq 'done org-log-done))
(setq org-log-done 'note)))
(defcustom org-log-reschedule nil
"Information to record when the scheduling date of a task is modified.
Possible values are:
nil Don't add anything, just change the date
time Add a time stamp to the task
note Prompt for a note and add it with template `org-log-note-headings'
This option can also be set with on a per-file-basis with
#+STARTUP: nologreschedule
#+STARTUP: logreschedule
#+STARTUP: lognotereschedule
You can have local logging settings for a subtree by setting the LOGGING
property to one or more of these keywords.
This variable has an effect when calling `org-schedule' or
`org-agenda-schedule' only."
:group 'org-todo
:group 'org-progress
:type '(choice
(const :tag "No logging" nil)
(const :tag "Record timestamp" time)
(const :tag "Record timestamp with note" note)))
(defcustom org-log-redeadline nil
"Information to record when the deadline date of a task is modified.
Possible values are:
nil Don't add anything, just change the date
time Add a time stamp to the task
note Prompt for a note and add it with template `org-log-note-headings'
This option can also be set with on a per-file-basis with
#+STARTUP: nologredeadline
#+STARTUP: logredeadline
#+STARTUP: lognoteredeadline
You can have local logging settings for a subtree by setting the LOGGING
property to one or more of these keywords.
This variable has an effect when calling `org-deadline' or
`org-agenda-deadline' only."
:group 'org-todo
:group 'org-progress
:type '(choice
(const :tag "No logging" nil)
(const :tag "Record timestamp" time)
(const :tag "Record timestamp with note." note)))
(defcustom org-log-note-clock-out nil
"Non-nil means record a note when clocking out of an item.
This can also be configured on a per-file basis by adding one of
the following lines anywhere in the buffer:
#+STARTUP: lognoteclock-out
#+STARTUP: nolognoteclock-out"
:group 'org-todo
:group 'org-progress
:type 'boolean)
(defcustom org-log-done-with-time t
"Non-nil means the CLOSED time stamp will contain date and time.
When nil, only the date will be recorded."
:group 'org-progress
:type 'boolean)
(defcustom org-log-note-headings
'((done . "CLOSING NOTE %t")
(state . "State %-12s from %-12S %t")
(note . "Note taken on %t")
(reschedule . "Rescheduled from %S on %t")
(delschedule . "Not scheduled, was %S on %t")
(redeadline . "New deadline from %S on %t")
(deldeadline . "Removed deadline, was %S on %t")
(refile . "Refiled on %t")
(clock-out . ""))
"Headings for notes added to entries.
The value is an alist, with the car being a symbol indicating the
note context, and the cdr is the heading to be used. The heading
may also be the empty string. The following placeholders can be
used:
%t a time stamp.
%T an active time stamp instead the default inactive one
%d a short-format time stamp.
%D an active short-format time stamp.
%s the new TODO state or time stamp (inactive), in double quotes.
%S the old TODO state or time stamp (inactive), in double quotes.
%u the user name.
%U full user name.
In fact, it is not a good idea to change the `state' entry,
because Agenda Log mode depends on the format of these entries."
:group 'org-todo
:group 'org-progress
:type '(list :greedy t
(cons (const :tag "Heading when closing an item" done) string)
(cons (const :tag
"Heading when changing todo state (todo sequence only)"
state) string)
(cons (const :tag "Heading when just taking a note" note) string)
(cons (const :tag "Heading when rescheduling" reschedule) string)
(cons (const :tag "Heading when an item is no longer scheduled" delschedule) string)
(cons (const :tag "Heading when changing deadline" redeadline) string)
(cons (const :tag "Heading when deleting a deadline" deldeadline) string)
(cons (const :tag "Heading when refiling" refile) string)
(cons (const :tag "Heading when clocking out" clock-out) string)))
(unless (assq 'note org-log-note-headings)
(push '(note . "%t") org-log-note-headings))
(defvaralias 'org-log-state-notes-into-drawer 'org-log-into-drawer)
(defcustom org-log-into-drawer nil
"Non-nil means insert state change notes and time stamps into a drawer.
When nil, state changes notes will be inserted after the headline and
any scheduling and clock lines, but not inside a drawer.
The value of this variable should be the name of the drawer to use.
LOGBOOK is proposed as the default drawer for this purpose, you can
also set this to a string to define the drawer of your choice.
A value of t is also allowed, representing \"LOGBOOK\".
A value of t or nil can also be set with on a per-file-basis with
#+STARTUP: logdrawer
#+STARTUP: nologdrawer
If this variable is set, `org-log-state-notes-insert-after-drawers'
will be ignored.
You can set the property LOG_INTO_DRAWER to overrule this setting for
a subtree.
Do not check directly this variable in a Lisp program. Call
function `org-log-into-drawer' instead."
:group 'org-todo
:group 'org-progress
:type '(choice
(const :tag "Not into a drawer" nil)
(const :tag "LOGBOOK" t)
(string :tag "Other")))
(defun org-log-into-drawer ()
"Name of the log drawer, as a string, or nil.
This is the value of `org-log-into-drawer'. However, if the
current entry has or inherits a LOG_INTO_DRAWER property, it will
be used instead of the default value."
(let ((p (org-entry-get nil "LOG_INTO_DRAWER" 'inherit t)))
(cond ((equal p "nil") nil)
((equal p "t") "LOGBOOK")
((stringp p) p)
(p "LOGBOOK")
((stringp org-log-into-drawer) org-log-into-drawer)
(org-log-into-drawer "LOGBOOK"))))
(defcustom org-log-state-notes-insert-after-drawers nil
"Non-nil means insert state change notes after any drawers in entry.
Only the drawers that *immediately* follow the headline and the
deadline/scheduled line are skipped.
When nil, insert notes right after the heading and perhaps the line
with deadline/scheduling if present.
This variable will have no effect if `org-log-into-drawer' is
set."
:group 'org-todo
:group 'org-progress
:type 'boolean)
(defcustom org-log-states-order-reversed t
"Non-nil means the latest state note will be directly after heading.
When nil, the state change notes will be ordered according to time.
This option can also be set with on a per-file-basis with
#+STARTUP: logstatesreversed
#+STARTUP: nologstatesreversed"
:group 'org-todo
:group 'org-progress
:type 'boolean)
(defcustom org-todo-repeat-to-state nil
"The TODO state to which a repeater should return the repeating task.
By default this is the first task of a TODO sequence or the
previous state of a TYPE_TODO set. But you can specify to use
the previous state in a TODO sequence or a string.
Alternatively, you can set the :REPEAT_TO_STATE: property of the
entry, which has precedence over this option."
:group 'org-todo
:version "24.1"
:type '(choice (const :tag "Use the previous TODO state" t)
(const :tag "Use the head of the TODO sequence" nil)
(string :tag "Use a specific TODO state")))
(defcustom org-log-repeat 'time
"Non-nil means record moving through the DONE state when triggering repeat.
An auto-repeating task is immediately switched back to TODO when
marked DONE. If you are not logging state changes (by adding \"@\"
or \"!\" to the TODO keyword definition), or set `org-log-done' to
record a closing note, there will be no record of the task moving
through DONE. This variable forces taking a note anyway.
nil Don't force a record
time Record a time stamp
note Prompt for a note and add it with template `org-log-note-headings'
This option can also be set with on a per-file-basis with
#+STARTUP: nologrepeat
#+STARTUP: logrepeat
#+STARTUP: lognoterepeat
You can have local logging settings for a subtree by setting the LOGGING
property to one or more of these keywords."
:group 'org-todo
:group 'org-progress
:type '(choice
(const :tag "Don't force a record" nil)
(const :tag "Force recording the DONE state" time)
(const :tag "Force recording a note with the DONE state" note)))
(defcustom org-todo-repeat-hook nil
"Hook that is run after a task has been repeated."
:package-version '(Org . "9.2")
:group 'org-todo
:type 'hook)
(defgroup org-priorities nil
"Priorities in Org mode."
:tag "Org Priorities"
:group 'org-todo)
(defvaralias 'org-enable-priority-commands 'org-priority-enable-commands)
(defcustom org-priority-enable-commands t
"Non-nil means priority commands are active.
When nil, these commands will be disabled, so that you never accidentally
set a priority."
:group 'org-priorities
:type 'boolean)
(defvaralias 'org-highest-priority 'org-priority-highest)
(defcustom org-priority-highest ?A
"The highest priority of TODO items.
A character like ?A, ?B, etc., or a numeric value like 1, 2, etc.
The default is the character ?A, which is 65 as a numeric value.
If you set `org-priority-highest' to a numeric value inferior to
65, Org assumes you want to use digits for the priority cookie.
If you set it to >=65, Org assumes you want to use alphabetical
characters.
In both cases, the value of `org-priority-highest' must be
smaller than `org-priority-lowest': for example, if \"A\" is the
highest priority, it is smaller than the lowest \"C\" priority:
65 < 67."
:group 'org-priorities
:type '(choice
(character :tag "Character")
(integer :tag "Integer (< 65)")))
(defvaralias 'org-lowest-priority 'org-priority-lowest)
(defcustom org-priority-lowest ?C
"The lowest priority of TODO items.
A character like ?C, ?B, etc., or a numeric value like 9, 8, etc.
The default is the character ?C, which is 67 as a numeric value.
If you set `org-priority-lowest' to a numeric value inferior to
65, Org assumes you want to use digits for the priority cookie.
If you set it to >=65, Org assumes you want to use alphabetical
characters.
In both cases, the value of `org-priority-lowest' must be greater
than `org-priority-highest': for example, if \"C\" is the lowest
priority, it is greater than the highest \"A\" priority: 67 >
65."
:group 'org-priorities
:type '(choice
(character :tag "Character")
(integer :tag "Integer (< 65)")))
(defvaralias 'org-default-priority 'org-priority-default)
(defcustom org-priority-default ?B
"The default priority of TODO items.
This is the priority an item gets if no explicit priority is given.
When starting to cycle on an empty priority the first step in the cycle
depends on `org-priority-start-cycle-with-default'. The resulting first
step priority must not exceed the range from `org-priority-highest' to
`org-priority-lowest' which means that `org-priority-default' has to be
in this range exclusive or inclusive to the range boundaries. Else the
first step refuses to set the default and the second will fall back on
\(depending on the command used) the highest or lowest priority."
:group 'org-priorities
:type '(choice
(character :tag "Character")
(integer :tag "Integer (< 65)")))
(defcustom org-priority-start-cycle-with-default t
"Non-nil means start with default priority when starting to cycle.
When this is nil, the first step in the cycle will be (depending on the
command used) one higher or lower than the default priority.
See also `org-priority-default'."
:group 'org-priorities
:type 'boolean)
(defvaralias 'org-get-priority-function 'org-priority-get-priority-function)
(defcustom org-priority-get-priority-function nil
"Function to extract the priority from a string.
The string is normally the headline. If this is nil, Org
computes the priority from the priority cookie like [#A] in the
headline. It returns an integer, increasing by 1000 for each
priority level.
The user can set a different function here, which should take a
string as an argument and return the numeric priority."
:group 'org-priorities
:version "24.1"
:type '(choice
(const nil)
(function)))
(defgroup org-time nil
"Options concerning time stamps and deadlines in Org mode."
:tag "Org Time"
:group 'org)
(defcustom org-time-stamp-rounding-minutes '(0 5)
"Number of minutes to round time stamps to.
\\<org-mode-map>\
These are two values, the first applies when first creating a time stamp.
The second applies when changing it with the commands `S-up' and `S-down'.
When changing the time stamp, this means that it will change in steps
of N minutes, as given by the second value.
When a setting is 0 or 1, insert the time unmodified. Useful rounding
numbers should be factors of 60, so for example 5, 10, 15.
When this is larger than 1, you can still force an exact time stamp by using
a double prefix argument to a time stamp command like \
`\\[org-time-stamp]' or `\\[org-time-stamp-inactive],
and by using a prefix arg to `S-up/down' to specify the exact number
of minutes to shift."
:group 'org-time
:get (lambda (var) ; Make sure both elements are there
(if (integerp (default-value var))
(list (default-value var) 5)
(default-value var)))
:type '(list
(integer :tag "when inserting times")
(integer :tag "when modifying times")))
;; Normalize old customizations of this variable.
(when (integerp org-time-stamp-rounding-minutes)
(setq org-time-stamp-rounding-minutes
(list org-time-stamp-rounding-minutes
org-time-stamp-rounding-minutes)))
(defcustom org-display-custom-times nil
"Non-nil means overlay custom formats over all time stamps.
The formats are defined through the variable `org-time-stamp-custom-formats'.
To turn this on on a per-file basis, insert anywhere in the file:
#+STARTUP: customtime"
:group 'org-time
:type 'sexp)
(make-variable-buffer-local 'org-display-custom-times)
(defcustom org-time-stamp-custom-formats
'("%m/%d/%y %a" . "%m/%d/%y %a %H:%M") ; american
"Custom formats for time stamps.
See `format-time-string' for the syntax.
These are overlaid over the default ISO format if the variable
`org-display-custom-times' is set. Time like %H:%M should be at the
end of the second format. The custom formats are also honored by export
commands, if custom time display is turned on at the time of export.
This variable also affects how timestamps are exported.
Leading \"<\" and trailing \">\" pair will be stripped from the format
strings."
:group 'org-time
:package-version '(Org . "9.6")
:type '(cons string string))
(defun org-time-stamp-format (&optional with-time inactive custom)
"Get timestamp format for a time string.
The format is based on `org-time-stamp-formats' (if CUSTOM is nil) or or
`org-time-stamp-custom-formats' (if CUSTOM if non-nil).
When optional argument WITH-TIME is non-nil, the timestamp will contain
time.
When optional argument INACTIVE is nil, format active timestamp.
When `no-brackets', strip timestamp brackets.
Otherwise, format inactive timestamp."
(let ((format (funcall
(if with-time #'cdr #'car)
(if custom
org-time-stamp-custom-formats
org-time-stamp-formats))))
;; Strip brackets, if any.
(when (or (and (string-prefix-p "<" format)
(string-suffix-p ">" format))
(and (string-prefix-p "[" format)
(string-suffix-p "]" format)))
(setq format (substring format 1 -1)))
(pcase inactive
(`no-brackets format)
(`nil (concat "<" format ">"))
(_ (concat "[" format "]")))))
(defcustom org-deadline-warning-days 14
"Number of days before expiration during which a deadline becomes active.
This variable governs the display in sparse trees and in the agenda.
When 0 or negative, it means use this number (the absolute value of it)
even if a deadline has a different individual lead time specified.
Custom commands can set this variable in the options section."
:group 'org-time
:group 'org-agenda-daily/weekly
:type 'integer)
(defcustom org-scheduled-delay-days 0
"Number of days before a scheduled item becomes active.
This variable governs the display in sparse trees and in the agenda.
The default value (i.e. 0) means: don't delay scheduled item.
When negative, it means use this number (the absolute value of it)
even if a scheduled item has a different individual delay time
specified.
Custom commands can set this variable in the options section."
:group 'org-time
:group 'org-agenda-daily/weekly
:version "24.4"
:package-version '(Org . "8.0")
:type 'integer)
(defcustom org-read-date-prefer-future t
"Non-nil means assume future for incomplete date input from user.
This affects the following situations:
1. The user gives a month but not a year.
For example, if it is April and you enter \"feb 2\", this will be read
as Feb 2, *next* year. \"May 5\", however, will be this year.
2. The user gives a day, but no month.
For example, if today is the 15th, and you enter \"3\", Org will read
this as the third of *next* month. However, if you enter \"17\",
it will be considered as *this* month.
If you set this variable to the symbol `time', then also the following
will work:
3. If the user gives a time.
If the time is before now, it will be interpreted as tomorrow.
Currently none of this works for ISO week specifications.
When this option is nil, the current day, month and year will always be
used as defaults.
See also `org-agenda-jump-prefer-future'."
:group 'org-time
:type '(choice
(const :tag "Never" nil)
(const :tag "Check month and day" t)
(const :tag "Check month, day, and ti
|