;;; org.el --- Outline-based notes management and organizer -*- lexical-binding: t; -*-
;; Carstens outline-mode for keeping track of everything.
;; Copyright (C) 2004-2024 Free Software Foundation, Inc.
;;
;; Author: Carsten Dominik <carsten.dominik@gmail.com>
;; Maintainer: Bastien Guerry <bzg@gnu.org>
;; Keywords: outlines, hypermedia, calendar, text
;; URL: https://orgmode.org
;; Package-Requires: ((emacs "26.1"))
;; Version: 9.8-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)
(require 'thingatpt)
(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)
(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-ast" (node))
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-copy "org-element-ast" (datum))
(declare-function org-element-create "org-element-ast" (type &optional props &rest children))
(declare-function org-element-extract "org-element-ast" (node))
(declare-function org-element-insert-before "org-element-ast" (node 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-ast" (blob &optional types with-self))
(declare-function org-element-property-inherited "org-element-ast"
(property node &optional with-self accumulate literal-nil include-nil))
(declare-function org-element-lineage-map "org-element-ast"
(datum fun &optional types with-self first-match))
(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 keep-deferred))
(declare-function org-element-parse-secondary-string "org-element" (string restriction &optional parent))
(declare-function org-element-property "org-element-ast" (property node))
(declare-function org-element-begin "org-element" (node))
(declare-function org-element-end "org-element" (node))
(declare-function org-element-contents-begin "org-element" (node))
(declare-function org-element-contents-end "org-element" (node))
(declare-function org-element-post-affiliated "org-element" (node))
(declare-function org-element-post-blank "org-element" (node))
(declare-function org-element-parent "org-element-ast" (node))
(declare-function org-element-put-property "org-element-ast" (node 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-ast" (node &optional anonymous))
(declare-function org-element-type-p "org-element-ast" (node types))
(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\\(\\(?:.\\|\n\\)+?\\)#\\+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.")
(defvaralias 'org-time-stamp-formats 'org-timestamp-formats)
(defconst org-timestamp-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
;; FIXME: Duplicate of `org-element-drawer-re'.
(rx line-start (0+ (any ?\s ?\t))
":" (group (1+ (any ?- ?_ word))) ":"
(0+ (any ?\s ?\t)) line-end)
"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 "\\)\\(?:.\\|\n\\)*?\\("
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\\*]+\\)\\(?:.\\|\n\\)+?\\\\end{\\2}\\)" 1 t)
;; ("$" "\\([ \t(]\\|^\\)\\(\\(\\([$]\\)\\([^ \t\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \t\n,.$]\\)\\4\\)\\)\\([ \t.,?;:'\")]\\|$\\)" 2 nil)
("$1" "\\([^$]\\|^\\)\\(\\$[^ \t\r\n,;.$]\\$\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|'\\|$\\)" 2 nil)
("$" "\\([^$]\\|^\\)\\(\\(\\$\\([^ \t\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \t\n,.$]\\)\\$\\)\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|'\\|$\\)" 2 nil)
("\\(" "\\\\(\\(?:.\\|\n\\)*?\\\\)" 0 nil)
("\\[" "\\\\\\[\\(?:.\\|\n\\)*?\\\\\\]" 0 nil)
("$$" "\\$\\$\\(?:.\\|\n\\)*?\\$\\$" 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-unless-debug 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 backends 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 backend \\=`%s\\='\"
backend))
((not (memq backend new-list)) (push backend new-list))))
(set-default \\='org-export-backends new-list)))
Adding a backend to this list will also pull the backend 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 backend not required anymore (not present in VAL and not
;; a parent of any backend in the new value) is removed from the
;; list of registered backends.
(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 backends 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 backend `%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-unless-debug nil (require (intern (format "ox-%s" backend)))
(error (message "Problems while trying to load export backend `%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
"Initial folding state of headings when entering Org mode.
Allowed values are:
symbol `nofold'
Do not fold headings.
symbol `fold'
Fold everything, leaving only top-level headings visible.
symbol `content'
Leave all the headings and sub-headings visible, but hide their
text. This is an equivalent of table of contents.
symbol `show2levels', `show3levels', `show4levels', `show5levels'
Show headings up to Nth level.
symbol `showeverything' (default)
Start Org mode in fully unfolded state. Unlike all other allowed
values, this value prevents drawers, blocks, and archived subtrees
from being folded even when `org-cycle-hide-block-startup',
`org-cycle-open-archived-trees', or `org-cycle-hide-drawer-startup'
are non-nil. Per-subtree visibility settings (see manual node
`(org)Initial visibility)') are also ignored.
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" nofold)
(const :tag "fold: overview" fold)
(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' enables you 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^(2 - i) expression inside round braces, including the
braces is read as a sub/superscript.
x_{i^2} curly braces do grouping; braces are not
considered a part of the sub/superscript.
Still, ambiguity is possible. So when in doubt, use {} to enclose
the sub/superscript. If you set this variable to the symbol `{}',
the curly braces are *required* in order to trigger interpretations as
sub/superscript. This can be helpful in documents that need \"_\"
frequently in plain text.
Setting this variable does not change Org mode markup. Org mode will
still parse the matching text as sub/superscript internally. It is
only the visual appearance that will be changed."
:group 'org-startup
:version "24.4"
:package-version '(Org . "8.0")
:type '(choice
(const :tag "Always interpret" t)
(const :tag "Only with curly 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)
(unless (boundp 'untrusted-content)
(defvar untrusted-content nil))
(defvar untrusted-content) ; defined in files.el since Emacs 29.3
(defvar org--latex-preview-when-risky nil
"If non-nil, enable LaTeX preview in Org buffers from unsafe source.
Some specially designed LaTeX code may generate huge pdf or log files
that may exhaust disk space.
This variable controls how to handle LaTeX preview when rendering LaTeX
fragments that originate from incoming email messages. It has no effect
when Org mode is unable to determine the origin of the Org buffer.
An Org buffer is considered to be from unsafe source when the
variable `untrusted-content' has a non-nil value in the buffer.
If this variable is non-nil, LaTeX previews are rendered unconditionally.
This variable may be renamed or changed in the future.")
(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: timestamp 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 reuse 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 an argument list to
`call-process' or `make-process' directly avoids
treating some character in peculiar file names
as shell specials that prompt parts of said file
names to be executed as subcommands.
`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 (dangerous), 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 (dangerous)" 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)
(defcustom org-after-note-stored-hook nil
"Hook triggered after a note is stored.
The point is at the stored note when the hook is executed."
:group 'org-progress
:type 'hook
:package-version '(Org . "9.7"))
(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
|