Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
24016 lines (22082 sloc) 909 KB
;;; org.el --- Outline-based notes management and organizer
;; Carstens outline-mode for keeping track of everything.
;; Copyright (C) 2004-2015 Free Software Foundation, Inc.
;; Author: Carsten Dominik <carsten at orgmode dot org>
;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage:
;; 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
;; 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 <>.
;;; Commentary:
;; Org-mode 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-mode 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
;; Documentation
;; -------------
;; The documentation of Org-mode can be found in the TeXInfo file. The
;; distribution also contains a PDF version of it. At the homepage of
;; Org-mode, 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 etc/ directory of Emacs 22.
;; A list of recent changes can be found at
;;; Code:
(defvar org-inhibit-highlight-removal nil) ; dynamically scoped param
(defvar org-table-formula-constants-local nil
"Local version of `org-table-formula-constants'.")
(make-variable-buffer-local 'org-table-formula-constants-local)
;;;; Require other packages
(require 'cl)
(require 'gnus-sum))
(require 'calendar)
(require 'find-func)
(require 'format-spec)
(load "org-loaddefs.el" t t t)
(require 'org-macs)
(require 'org-compat)
;; `org-outline-regexp' ought to be a defconst but is let-bound in
;; some places -- e.g. see the macro `org-with-limited-levels'.
;; In Org buffers, the value of `outline-regexp' is that of
;; `org-outline-regexp'. The only function still directly relying on
;; `outline-regexp' is `org-overview' so that `org-cycle' can do its
;; job when `orgstruct-mode' is active.
(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.")
;; Emacs 22 calendar compatibility: Make sure the new variables are available
(unless (boundp 'calendar-view-holidays-initially-flag)
(org-defvaralias 'calendar-view-holidays-initially-flag
(unless (boundp 'calendar-view-diary-initially-flag)
(org-defvaralias 'calendar-view-diary-initially-flag
(unless (boundp 'diary-fancy-buffer)
(org-defvaralias 'diary-fancy-buffer 'fancy-diary-buffer))
(declare-function org-add-archive-files "org-archive" (files))
(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-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label))
(declare-function org-clock-get-last-clock-out-time "org-clock" ())
(declare-function org-clock-timestamps-up "org-clock" (&optional n))
(declare-function org-clock-timestamps-down "org-clock" (&optional n))
(declare-function org-clock-remove-overlays "org-clock" (&optional beg end noremove))
(declare-function org-clock-sum-current-item "org-clock" (&optional tstart))
(declare-function org-clock-update-time-maybe "org-clock" ())
(declare-function org-clocktable-shift "org-clock" (dir n))
(declare-function orgtbl-mode "org-table" (&optional arg))
(declare-function org-clock-out "org-clock" (&optional switch-to-state fail-quietly at-time))
(declare-function org-beamer-mode "ox-beamer" ())
(declare-function org-table-edit-field "org-table" (arg))
(declare-function org-table-justify-field-maybe "org-table" (&optional new))
(declare-function org-table-set-constants "org-table" ())
(declare-function org-table-calc-current-TBLFM "org-table" (&optional arg))
(declare-function org-id-get-create "org-id" (&optional force))
(declare-function org-id-find-id-file "org-id" (id))
(declare-function org-tags-view "org-agenda" (&optional todo-only match))
(declare-function org-agenda-list "org-agenda" (&optional arg start-day span))
(declare-function org-agenda-redo "org-agenda" (&optional all))
(declare-function org-table-align "org-table" ())
(declare-function org-table-begin "org-table" (&optional table-type))
(declare-function org-table-blank-field "org-table" ())
(declare-function org-table-end "org-table" (&optional table-type))
(declare-function org-table-insert-row "org-table" (&optional arg))
(declare-function org-table-paste-rectangle "org-table" ())
(declare-function org-table-maybe-eval-formula "org-table" ())
(declare-function org-table-maybe-recalculate-line "org-table" ())
(declare-function org-element--parse-objects "org-element"
(beg end acc restriction))
(declare-function org-element-at-point "org-element" (&optional keep-trail))
(declare-function org-element-contents "org-element" (element))
(declare-function org-element-context "org-element" (&optional element))
(declare-function org-element-interpret-data "org-element"
(data &optional parent))
(declare-function org-element-map "org-element"
(data types fun &optional info first-match no-recursion))
(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-property "org-element" (property element))
(declare-function org-element-put-property "org-element"
(element property value))
(declare-function org-element-swap-A-B "org-element" (elem-a elem-b))
(declare-function org-element--parse-objects "org-element"
(beg end acc restriction))
(declare-function org-element-parse-buffer "org-element"
(&optional granularity visible-only))
(declare-function org-element-restriction "org-element" (element))
(declare-function org-element-type "org-element" (element))
;; load languages based on value of `org-babel-load-languages'
(defvar org-babel-load-languages)
(defun org-babel-do-load-languages (sym value)
"Load the languages defined in `org-babel-load-languages'."
(set-default sym value)
(mapc (lambda (pair)
(let ((active (cdr pair)) (lang (symbol-name (car pair))))
(if active
(require (intern (concat "ob-" lang))))
(funcall 'fmakunbound
(intern (concat "org-babel-execute:" lang)))
(funcall 'fmakunbound
(intern (concat "org-babel-expand-body:" lang)))))))
(declare-function org-babel-tangle-file "ob-tangle" (file &optional target-file lang))
(defun org-babel-load-file (file &optional compile)
"Load Emacs Lisp source code blocks in the Org-mode FILE.
This function exports the source code using `org-babel-tangle'
and then loads the resulting file using `load-file'. With prefix
arg (noninteractively: 2nd arg) COMPILE the tangled Emacs Lisp
file to byte-code before it is loaded."
(interactive "fFile to load: \nP")
(require 'ob-core)
(let* ((age (lambda (file)
(time-subtract (current-time)
(nth 5 (or (file-attributes (file-truename file))
(file-attributes file)))))))
(base-name (file-name-sans-extension file))
(exported-file (concat base-name ".el")))
;; tangle if the org-mode file is newer than the elisp file
(unless (and (file-exists-p exported-file)
(> (funcall age file) (funcall age exported-file)))
(setq exported-file
(car (org-babel-tangle-file file exported-file "emacs-lisp"))))
(message "%s %s"
(if compile
(progn (byte-compile-file exported-file 'load)
"Compiled and loaded")
(progn (load-file exported-file) "Loaded"))
(defcustom org-babel-load-languages '((emacs-lisp . t))
"Languages which can be evaluated in Org-mode buffers.
This list can be used to load support for any of the languages
below, note that each language will depend on a different set of
system executables and/or Emacs modes. When a language is
\"loaded\", then code blocks in that language can be evaluated
with `org-babel-execute-src-block' bound by default to C-c
C-c (note the `org-babel-no-eval-on-ctrl-c-ctrl-c' variable can
be set to remove code block evaluation from the C-c C-c
keybinding. By default only Emacs Lisp (which has no
requirements) is loaded."
:group 'org-babel
:set 'org-babel-do-load-languages
:version "24.1"
:type '(alist :tag "Babel Languages"
(const :tag "Awk" awk)
(const :tag "C" C)
(const :tag "R" R)
(const :tag "Asymptote" asymptote)
(const :tag "Calc" calc)
(const :tag "Clojure" clojure)
(const :tag "CSS" css)
(const :tag "Ditaa" ditaa)
(const :tag "Dot" dot)
(const :tag "Emacs Lisp" emacs-lisp)
(const :tag "Fortran" fortran)
(const :tag "Gnuplot" gnuplot)
(const :tag "Haskell" haskell)
(const :tag "IO" io)
(const :tag "Java" java)
(const :tag "Javascript" js)
(const :tag "LaTeX" latex)
(const :tag "Ledger" ledger)
(const :tag "Lilypond" lilypond)
(const :tag "Lisp" lisp)
(const :tag "Makefile" makefile)
(const :tag "Maxima" maxima)
(const :tag "Matlab" matlab)
(const :tag "Mscgen" mscgen)
(const :tag "Ocaml" ocaml)
(const :tag "Octave" octave)
(const :tag "Org" org)
(const :tag "Perl" perl)
(const :tag "Pico Lisp" picolisp)
(const :tag "PlantUML" plantuml)
(const :tag "Python" python)
(const :tag "Ruby" ruby)
(const :tag "Sass" sass)
(const :tag "Scala" scala)
(const :tag "Scheme" scheme)
(const :tag "Screen" screen)
(const :tag "Shell Script" sh)
(const :tag "Shen" shen)
(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
:type 'boolean
:version "24.1"
:group 'org-id)
;;; Version
(defun org-version (&optional here full message)
"Show the org-mode version in the echo area.
With prefix argument HERE, insert it at point.
When FULL is non-nil, use a verbose version string.
When MESSAGE is non-nil, display a message with the version."
(interactive "P")
(let* ((org-dir (ignore-errors (org-find-library-dir "org")))
(save-load-suffixes (when (boundp 'load-suffixes) load-suffixes))
(load-suffixes (list ".el"))
(org-install-dir (ignore-errors (org-find-library-dir "org-loaddefs")))
(org-trash (or
(and (fboundp 'org-release) (fboundp 'org-git-version))
(org-load-noerror-mustsuffix (concat org-dir "org-version"))))
(load-suffixes save-load-suffixes)
(org-version (org-release))
(git-version (org-git-version))
(version (format "Org-mode version %s (%s @ %s)"
(if org-install-dir
(if (string= org-dir org-install-dir)
(concat "mixed installation! " org-install-dir " and " org-dir))
"org-loaddefs.el can not be found!")))
(version1 (if full version org-version)))
(if (org-called-interactively-p 'interactive)
(if here
(insert version)
(message version))
(if message (message version1))
(defconst org-version (org-version))
;;; Compatibility constants
;;; 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)
(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?")
(defun org-load-modules-maybe (&optional force)
"Load all extensions listed in `org-modules'."
(when (or force (not org-modules-loaded))
(mapc (lambda (ext)
(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 var value)
(when (featurep 'org)
(org-load-modules-maybe 'force)))
(defcustom org-modules '(org-w3m org-bbdb org-bibtex org-docview org-gnus org-info org-irc org-mhe org-rmail)
"Modules that should always be loaded together with org.el.
If a description starts with <C>, the file is not part of Emacs
and loading it will require that you have downloaded and properly
installed the Org mode distribution.
You can also use this system to load external packages (i.e. neither Org
core modules, nor modules from the CONTRIB directory). 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
:version "24.4"
:package-version '(Org . "8.0")
'(set :greedy t
(const :tag " bbdb: Links to BBDB entries" org-bbdb)
(const :tag " bibtex: Links to BibTeX entries" org-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 doc-view buffers" org-docview)
(const :tag " gnus: Links to GNUS folders/messages" org-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" org-info)
(const :tag " inlinetask: Tasks independent of outline hierarchy" org-inlinetask)
(const :tag " irc: Links to IRC/ERC chat sessions" org-irc)
(const :tag " mhe: Links to MHE folders/messages" org-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" org-rmail)
(const :tag " w3m: Special cut/paste from w3m to Org-mode." org-w3m)
(const :tag "C annotate-file: Annotate a file with org syntax" org-annotate-file)
(const :tag "C bookmark: Org-mode links to bookmarks" org-bookmark)
(const :tag "C bullets: Add overlays to headlines stars" org-bullets)
(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 drill: Flashcards and spaced repetition for Org-mode" org-drill)
(const :tag "C elisp-symbol: Org-mode links to emacs-lisp symbols" org-elisp-symbol)
(const :tag "C eshell Support for links to working directories in eshell" org-eshell)
(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-mode entries" org-expiry)
(const :tag "C favtable: Lookup table of favorite references and links" org-favtable)
(const :tag "C git-link: Provide org links to specific file version" org-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 jira: Add a jira:ticket protocol to Org-mode" org-jira)
(const :tag "C learn: SuperMemo's incremental learning algorithm" org-learn)
(const :tag "C mac-iCal Imports events from 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-mode for different MUAs" org-mairix)
(const :tag "C man: Support for links to manpages in Org-mode" org-man)
(const :tag "C mew: Links to Mew folders/messages" org-mew)
(const :tag "C mtags: Support for muse-like tags" org-mtags)
(const :tag "C notmuch: Provide org links to notmuch searches or messages" org-notmuch)
(const :tag "C panel: Simple routines for us with bad memory" org-panel)
(const :tag "C registry: A registry for Org-mode links" org-registry)
(const :tag "C screen: Visit screen sessions through Org-mode links" org-screen)
(const :tag "C secretary: Team management with org-mode" org-secretary)
(const :tag "C sqlinsert: Convert Org-mode tables to SQL insertions" orgtbl-sqlinsert)
(const :tag "C toc: Table of contents for Org-mode 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" org-vm)
(const :tag "C wikinodes: CamelCase wiki-like links" org-wikinodes)
(const :tag "C wl: Links to Wanderlust folders/messages" org-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))
(defcustom org-export-backends '(ascii html icalendar latex)
"List of export back-ends that should be always available.
If a description starts with <C>, the file is not part of Emacs
and loading it will require that you have downloaded and properly
installed the Org mode distribution.
Unlike to `org-modules', libraries in this list will not be
loaded along with Org, but only once the export framework is
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:
\(setq org-export--registered-backends
\(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)))))))
\(let ((new-list (mapcar 'org-export-backend-name
\(dolist (backend val)
\((not (load (format \"ox-%s\" backend) t t))
\(message \"Problems while trying to load export back-end `%s'\"
\((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 "24.4"
:package-version '(Org . "8.0")
:initialize 'custom-initialize-set
:set (lambda (var val)
(if (not (featurep 'ox)) (set-default 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
(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)))))))
;; Now build NEW-LIST of both new back-ends and required
;; parents.
(let ((new-list (mapcar 'org-export-backend-name
(dolist (backend val)
((not (load (format "ox-%s" backend) t t))
(message "Problems while trying to load export back-end `%s'"
((not (memq backend new-list)) (push backend new-list))))
;; Set VAR to that list with fixed dependencies.
(set-default 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
(lambda (backend)
(condition-case nil (require (intern (format "ox-%s" backend)))
(error (message "Problems while trying to load export back-end `%s'"
(defcustom org-support-shift-select nil
"Non-nil means make shift-cursor commands select text when possible.
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).
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, and item lines,
to make shift selection work there as well. If this is what you
want, you can use the following alternative commands: `C-c C-t'
and `C-c ,' to change TODO state and priority, `C-u C-u C-c C-t'
can be used to switch TODO sets, `C-c -' 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.
XEmacs user should have this variable set to nil, because
`shift-select-mode' is in Emacs 23 or later only."
: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 nil
"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-archive-subtree', `org-archive-set-tag' and
`org-archive-to-archive-sibling'. The archiving commands skip
already archived entries."
: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"))
:version "24.1"
:group 'org-todo
:group 'org-archive)
(defgroup org-startup nil
"Options concerning startup of Org-mode."
:tag "Org Startup"
:group 'org)
(defcustom org-startup-folded t
"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: showeverything
By default, this option is ignored when Org opens agenda files
for the first time. If you want the agenda to honor the startup
option, set `org-agenda-inhibit-startup' to nil."
:group 'org-startup
:type '(choice
(const :tag "nofold: show all" nil)
(const :tag "fold: overview" t)
(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."
: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-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'. `org-use-sub-superscripts'
used to be an alias for `org-export-with-sub-superscripts' in
Org <8.0, it is not anymore.
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 is useful when the column width in tables is forced with <N> cookies
in table fields. Such tables will look correct only after the first re-align.
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-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-replace-disputed-keys nil
"Non-nil means use alternative key bindings for some keys.
Org-mode uses S-<cursor> keys for changing timestamps and priorities.
These keys are also used by other packages like shift-selection-mode'
\(built into Emacs 23), `CUA-mode' or `windmove.el'.
If you want to use Org-mode together with one of these other modes,
or more generally if you would like to move some Org-mode commands to
other keys, set this variable and configure the keys with the variable
This option is only relevant at load-time of Org-mode, and must be set
*before* org.el is loaded. Changing it requires a restart of Emacs to
become effective."
:group 'org-startup
:type 'boolean)
(defcustom org-use-extra-keys nil
"Non-nil means use extra key sequence definitions for certain commands.
This happens automatically if you run XEmacs or if `window-system'
is nil. This variable lets you do the same manually. You must
set it before loading org.
Example: on Carbon Emacs 22 running graphically, with an external
keyboard on a Powerbook, the default way of setting M-left might
not work for either Alt or ESC. Setting this variable will make
it work for ESC."
:group 'org-startup
:type 'boolean)
(org-defvaralias 'org-CUA-compatible 'org-replace-disputed-keys)
(defcustom org-disputed-keys
'(([(shift up)] . [(meta p)])
([(shift down)] . [(meta n)])
([(shift left)] . [(meta -)])
([(shift right)] . [(meta +)])
([(control shift right)] . [(meta shift +)])
([(control shift left)] . [(meta shift -)]))
"Keys for which Org-mode and other modes compete.
This is an alist, cars are the default keys, second element specifies
the alternative to use when `org-replace-disputed-keys' is t.
Keys can be specified in any syntax supported by `define-key'.
The value of this option takes effect only at Org-mode's startup,
therefore you'll have to restart Emacs to apply it after changing."
:group 'org-startup
:type 'alist)
(defun org-key (key)
"Select key according to `org-replace-disputed-keys' and `org-disputed-keys'.
Or return the original if not disputed.
Also apply the translations defined in `org-xemacs-key-equivalents'."
(when org-replace-disputed-keys
(let* ((nkey (key-description key))
(x (org-find-if (lambda (x)
(equal (key-description (car x)) nkey))
(setq key (if x (cdr x) key))))
(when (featurep 'xemacs)
(setq key (or (cdr (assoc key org-xemacs-key-equivalents)) key)))
(defun org-find-if (predicate seq)
(catch 'exit
(while seq
(if (funcall predicate (car seq))
(throw 'exit (car seq))
(pop seq)))))
(defun org-defkey (keymap key def)
"Define a key, possibly translated, as returned by `org-key'."
(define-key keymap (org-key key) def))
(defcustom org-ellipsis nil
"The ellipsis to use in the Org-mode outline.
When nil, just use the standard three dots.
When a string, use that string instead.
When a face, use the standard 3 dots, but with the specified face.
The change affects only Org-mode (which will then use its own display table).
Changing this requires executing `M-x org-mode RET' in a buffer to become
:group 'org-startup
:type '(choice (const :tag "Default" nil)
(face :tag "Face" :value org-warning)
(string :tag "String" :value "...#")))
(defvar org-display-table nil
"The display table for org-mode, in case `org-ellipsis' is non-nil.")
(defgroup org-keywords nil
"Keywords in Org-mode."
:tag "Org Keywords"
:group 'org)
(defcustom org-deadline-string "DEADLINE:"
"String to mark deadline entries.
A deadline is this string, followed by a time stamp. Should be a word,
terminated by a colon. You can insert a schedule keyword and
a timestamp with \\[org-deadline].
Changes become only effective after restarting Emacs."
:group 'org-keywords
:type 'string)
(defcustom org-scheduled-string "SCHEDULED:"
"String to mark scheduled TODO entries.
A schedule is this string, followed by a time stamp. Should be a word,
terminated by a colon. You can insert a schedule keyword and
a timestamp with \\[org-schedule].
Changes become only effective after restarting Emacs."
:group 'org-keywords
:type 'string)
(defcustom org-closed-string "CLOSED:"
"String used as the prefix for timestamps logging closing a TODO entry."
:group 'org-keywords
:type 'string)
(defcustom org-clock-string "CLOCK:"
"String used as prefix for timestamps clocking work hours on an item."
:group 'org-keywords
:type 'string)
(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)
(defconst org-planning-or-clock-line-re (concat "^[ \t]*\\("
org-scheduled-string "\\|"
org-deadline-string "\\|"
org-closed-string "\\|"
org-clock-string "\\)")
"Matches a line with planning or clock info.")
(defcustom org-comment-string "COMMENT"
"Entries starting with this keyword will never be exported.
An entry can be toggled between COMMENT and normal with
Changes become only effective after restarting Emacs."
:group 'org-keywords
:type 'string)
(defcustom org-quote-string "QUOTE"
"Entries starting with this keyword will be exported in fixed-width font.
Quoting applies only to the text in the entry following the headline, and does
not extend beyond the next headline, even if that is lower level.
An entry can be toggled between QUOTE and normal with
:group 'org-keywords
:type 'string)
(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.")
(defgroup org-structure nil
"Options concerning the general structure of Org-mode files."
:tag "Org Structure"
:group 'org)
(defgroup org-reveal-location nil
"Options about how to make context of a location visible."
:tag "Org Reveal Location"
:group 'org-structure)
(defconst org-context-choice
(const :tag "Always" t)
(const :tag "Never" nil)
(repeat :greedy t :tag "Individual contexts"
(choice :tag "Context"
(const agenda)
(const org-goto)
(const occur-tree)
(const tags-tree)
(const link-search)
(const mark-goto)
(const bookmark-jump)
(const isearch)
(const default))
"Contexts for the reveal options.")
(defcustom org-show-hierarchy-above '((default . t))
"Non-nil means show full hierarchy when revealing a location.
Org-mode often shows locations in an org-mode file which might have
been invisible before. When this is set, the hierarchy of headings
above the exposed location is shown.
Turning this off for example for sparse trees makes them very compact.
Instead of t, this can also be an alist specifying this option for different
contexts. Valid contexts are
agenda when exposing an entry from the agenda
org-goto when using the command `org-goto' on key C-c C-j
occur-tree when using the command `org-occur' on key C-c /
tags-tree when constructing a sparse tree based on tags matches
link-search when exposing search matches associated with a link
mark-goto when exposing the jump goal of a mark
bookmark-jump when exposing a bookmark location
isearch when exiting from an incremental search
default default for all contexts not set explicitly"
:group 'org-reveal-location
:type org-context-choice)
(defcustom org-show-following-heading '((default . nil))
"Non-nil means show following heading when revealing a location.
Org-mode often shows locations in an org-mode file which might have
been invisible before. When this is set, the heading following the
match is shown.
Turning this off for example for sparse trees makes them very compact,
but makes it harder to edit the location of the match. In such a case,
use the command \\[org-reveal] to show more context.
Instead of t, this can also be an alist specifying this option for different
contexts. See `org-show-hierarchy-above' for valid contexts."
:group 'org-reveal-location
:type org-context-choice)
(defcustom org-show-siblings '((default . nil) (isearch t) (bookmark-jump t))
"Non-nil means show all sibling heading when revealing a location.
Org-mode often shows locations in an org-mode file which might have
been invisible before. When this is set, the sibling of the current entry
heading are all made visible. If `org-show-hierarchy-above' is t,
the same happens on each level of the hierarchy above the current entry.
By default this is on for the isearch context, off for all other contexts.
Turning this off for example for sparse trees makes them very compact,
but makes it harder to edit the location of the match. In such a case,
use the command \\[org-reveal] to show more context.
Instead of t, this can also be an alist specifying this option for different
contexts. See `org-show-hierarchy-above' for valid contexts."
:group 'org-reveal-location
:type org-context-choice
:version "24.4"
:package-version '(Org . "8.0"))
(defcustom org-show-entry-below '((default . nil))
"Non-nil means show the entry below a headline when revealing a location.
Org-mode often shows locations in an org-mode file which might have
been invisible before. When this is set, the text below the headline that is
exposed is also shown.
By default this is off for all contexts.
Instead of t, this can also be an alist specifying this option for different
contexts. See `org-show-hierarchy-above' for valid contexts."
:group 'org-reveal-location
:type org-context-choice)
(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)))
(defcustom org-use-speed-commands nil
"Non-nil means activate single letter commands at beginning of a headline.
This may also be a function to test for appropriate locations where speed
commands should be active."
:group 'org-structure
:type '(choice
(const :tag "Never" nil)
(const :tag "At beginning of headline stars" t)
(defcustom org-speed-commands-user nil
"Alist of additional speed commands.
This list will be checked before `org-speed-commands-default'
when the variable `org-use-speed-commands' is non-nil
and when the cursor is at the beginning of a headline.
The car if each entry is a string with a single letter, which must
be assigned to `self-insert-command' in the global map.
The cdr is either a command to be called interactively, a function
to be called, or a form to be evaluated.
An entry that is just a list with a single string will be interpreted
as a descriptive headline that will be added when listing the speed
commands in the Help buffer using the `?' speed command."
:group 'org-structure
:type '(repeat :value ("k" . ignore)
(choice :value ("k" . ignore)
(list :tag "Descriptive Headline" (string :tag "Headline"))
(cons :tag "Letter and Command"
(string :tag "Command letter")
(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:
When a key does not show up in the property list, the corresponding bookmark
is not set."
:group 'org-structure
:type 'plist)
(defgroup org-cycle nil
"Options concerning visibility cycling in Org-mode."
:tag "Org Cycle"
:group 'org-structure)
(defcustom org-cycle-skip-children-state-if-no-children t
"Non-nil means skip CHILDREN state in entries that don't have any."
:group 'org-cycle
:type 'boolean)
(defcustom org-cycle-max-level nil
"Maximum level which should still be subject to visibility cycling.
Levels higher than this will, for cycling, be treated as text, not a headline.
When `org-odd-levels-only' is set, a value of N in this variable actually
means 2N-1 stars as the limiting headline.
When nil, cycle all levels.
Note that the limiting level of cycling is also influenced by
`org-inlinetask-min-level'. When `org-cycle-max-level' is not set but
`org-inlinetask-min-level' is, cycling will be limited to levels one less
than its value."
:group 'org-cycle
:type '(choice
(const :tag "No limit" nil)
(integer :tag "Maximum level")))
(defcustom org-drawers '("PROPERTIES" "CLOCK" "LOGBOOK" "RESULTS")
"Names of drawers. Drawers are not opened by cycling on the headline above.
Drawers only open with a TAB on the drawer line itself. A drawer looks like
The drawer \"PROPERTIES\" is special for capturing properties through
the property API.
Drawers can be defined on the per-file basis with a line like:
:group 'org-structure
:group 'org-cycle
:type '(repeat (string :tag "Drawer Name")))
(defcustom org-hide-block-startup nil
"Non-nil means entering Org-mode will fold all blocks.
This can also be set in on a per-file basis with
#+STARTUP: hideblocks
#+STARTUP: showblocks"
:group 'org-startup
:group 'org-cycle
:type 'boolean)
(defcustom org-cycle-global-at-bob nil
"Cycle globally if cursor is at beginning of buffer and not at a headline.
This makes it possible to do global cycling without having to use S-TAB or
\\[universal-argument] TAB. For this special case to work, the first line
of the buffer must not be a headline -- it may be empty or some other text.
When used in this way, `org-cycle-hook' is disabled temporarily to make
sure the cursor stays at the beginning of the buffer. When this option is
nil, don't do anything special at the beginning of the buffer."
:group 'org-cycle
:type 'boolean)
(defcustom org-cycle-level-after-item/entry-creation t
"Non-nil means cycle entry level or item indentation in new empty entries.
When the cursor is at the end of an empty headline, i.e., with only stars
and maybe a TODO keyword, TAB will then switch the entry to become a child,
and then all possible ancestor states, before returning to the original state.
This makes data entry extremely fast: M-RET to create a new headline,
on TAB to make it a child, two or more tabs to make it a (grand-)uncle.
When the cursor is at the end of an empty plain list item, one TAB will
make it a subitem, two or more tabs will back up to make this an item
higher up in the item hierarchy."
:group 'org-cycle
:type 'boolean)
(defcustom org-cycle-emulate-tab t
"Where should `org-cycle' emulate TAB.
nil Never
white Only in completely white lines
whitestart Only at the beginning of lines, before the first non-white char
t Everywhere except in headlines
exc-hl-bol Everywhere except at the start of a headline
If TAB is used in a place where it does not emulate TAB, the current subtree
visibility is cycled."
:group 'org-cycle
:type '(choice (const :tag "Never" nil)
(const :tag "Only in completely white lines" white)
(const :tag "Before first char in a line" whitestart)
(const :tag "Everywhere except in headlines" t)
(const :tag "Everywhere except at bol in headlines" exc-hl-bol)))
(defcustom org-cycle-separator-lines 2
"Number of empty lines needed to keep an empty line between collapsed trees.
If you leave an empty line between the end of a subtree and the following
headline, this empty line is hidden when the subtree is folded.
Org-mode will leave (exactly) one empty line visible if the number of
empty lines is equal or larger to the number given in this variable.
So the default 2 means at least 2 empty lines after the end of a subtree
are needed to produce free space between a collapsed subtree and the
following headline.
If the number is negative, and the number of empty lines is at least -N,
all empty lines are shown.
Special case: when 0, never leave empty lines in collapsed view."
:group 'org-cycle
:type 'integer)
(put 'org-cycle-separator-lines 'safe-local-variable 'integerp)
(defcustom org-pre-cycle-hook nil
"Hook that is run before visibility cycling is happening.
The function(s) in this hook must accept a single argument which indicates
the new state that will be set right after running this hook. The
argument is a symbol. Before a global state change, it can have the values
`overview', `content', or `all'. Before a local state change, it can have
the values `folded', `children', or `subtree'."
:group 'org-cycle
:type 'hook)
(defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees
"Hook that is run after `org-cycle' has changed the buffer visibility.
The function(s) in this hook must accept a single argument which indicates
the new state that was set by the most recent `org-cycle' command. The
argument is a symbol. After a global state change, it can have the values
`overview', `contents', or `all'. After a local state change, it can have
the values `folded', `children', or `subtree'."
:group 'org-cycle
:type 'hook)
(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 t
"Non-nil means adapt indentation to outline node level.
When this variable is set, Org assumes that you write outlines by
indenting text in each node to align with the headline (after the stars).
The following issues are influenced by this variable:
- When this is set and the *entire* text in an entry is indented, the
indentation is increased by one space in a demotion command, and
decreased by one in a promotion command. If any line in the entry
body starts with text at column 0, indentation is not changed at all.
- Property drawers and planning information is inserted indented when
this variable s set. When nil, they will not be indented.
- TAB indents a line relative to context. The lines below a headline
will be indented when this variable is set.
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 'boolean)
(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
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)))))
(org-defvaralias 'org-special-ctrl-a 'org-special-ctrl-a/e)
(defcustom org-special-ctrl-k nil
"Non-nil means `C-k' will behave specially in headlines.
When nil, `C-k' will call the default `kill-line' command.
When t, the following will happen while the cursor is in the headline:
- When the cursor is at the beginning of a headline, kill the entire
line and possible the folded subtree below the line.
- When in the middle of the headline text, kill the headline up to the tags.
- When after the headline text, kill 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 `C-o' insert a row in tables."
:group 'org-edit-structure
:type 'boolean)
(defcustom org-catch-invisible-edits nil
"Check if in invisible region before inserting or deleting a character.
Valid values are:
nil Do not check, so just do invisible edits.
error Throw an error and do nothing.
show Make point visible, and do the requested edit.
show-and-error Make point visible, then throw an error and abort the edit.
smart Make point visible, and do insertion/deletion if it is
adjacent to visible text and the change feels predictable.
Never delete a previously invisible character or add in the
middle or right after an invisible region. Basically, this
allows insertion and backward-delete right before ellipses.
FIXME: maybe in this case we should not even show?"
:group 'org-edit-structure
:version "24.1"
:type '(choice
(const :tag "Do not check" nil)
(const :tag "Throw error when trying to edit" error)
(const :tag "Unhide, but do not do the edit" show-and-error)
(const :tag "Show invisible part and do the edit" show)
(const :tag "Be smart and do the right thing" smart)))
(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
:group 'org-structure
:group 'org-table
:type '(choice
(const :tag "Always" t)
(const :tag "Never" nil)
(repeat :greedy t :tag "Individual contexts"
(choice :tag "Context"
(const headline)
(const item)
(const table)
(const default))
(defcustom org-insert-heading-respect-content nil
"Non-nil means insert new headings after the current subtree.
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.
For plain lists, if `org-list-empty-line-terminates-plain-lists' is set,
the setting here is ignored and no empty line is inserted to avoid breaking
the list structure."
: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)
(defcustom org-enable-fixed-width-editor t
"Non-nil means lines starting with \":\" are treated as fixed-width.
This currently only means they are never auto-wrapped.
When nil, such lines will be treated like ordinary lines.
See also the QUOTE keyword."
:group 'org-edit-structure
:type 'boolean)
(defcustom org-goto-auto-isearch t
"Non-nil means typing characters in `org-goto' starts incremental search.
When nil, you can use these keybindings to navigate the buffer:
q Quit the org-goto interface
n Go to the next visible heading
p Go to the previous visible heading
f Go one heading forward on same level
b Go one heading backward on same level
u Go one heading up"
:group 'org-edit-structure
:type 'boolean)
(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.
Such highlights are created by `org-occur' and `org-clock-display'.
When nil, `C-c C-c needs to be used to get rid of the highlights.
The highlights created by `org-preview-latex-fragment' always need
`C-c C-c' to be removed."
:group 'org-sparse-trees
:group 'org-time
:type 'boolean)
(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)
(defgroup org-imenu-and-speedbar nil
"Options concerning imenu and speedbar in Org-mode."
:tag "Org Imenu and Speedbar"
:group 'org-structure)
(defcustom org-imenu-depth 2
"The maximum level for Imenu access to Org-mode headlines.
This also applied for speedbar access."
:group 'org-imenu-and-speedbar
:type 'integer)
(defgroup org-table nil
"Options concerning tables in Org-mode."
:tag "Org Table"
:group 'org)
(defcustom org-enable-table-editor 'optimized
"Non-nil means lines starting with \"|\" are handled by the table editor.
When nil, such lines will be treated like ordinary lines.
When equal to the symbol `optimized', the table editor will be optimized to
do the following:
- Automatic overwrite mode in front of whitespace in table fields.
This makes the structure of the table stay in tact as long as the edited
field does not exceed the column width.
- Minimize the number of realigns. Normally, the table is aligned each time
TAB or RET are pressed to move to another field. With optimization this
happens only if changes to a field might have changed the column width.
Optimization requires replacing the functions `self-insert-command',
`delete-char', and `backward-delete-char' in Org-mode buffers, with a
slight (in fact: unnoticeable) speed impact for normal typing. Org-mode is
very good at guessing when a re-align will be necessary, but you can always
force one with \\[org-ctrl-c-ctrl-c].
If you would like to use the optimized version in Org-mode, but the
un-optimized version in OrgTbl-mode, see the variable `orgtbl-optimized'.
This variable can be used to turn on and off the table editor during a session,
but in order to toggle optimization, a restart is required.
See also the variable `org-table-auto-blank-field'."
:group 'org-table
:type '(choice
(const :tag "off" nil)
(const :tag "on" t)
(const :tag "on, optimized" optimized)))
(defcustom org-self-insert-cluster-for-undo (or (featurep 'xemacs)
(version<= emacs-version "24.1"))
"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)
(defcustom org-table-tab-recognizes-table.el t
"Non-nil means TAB will automatically notice a table.el table.
When it sees such a table, it moves point into it and - if necessary -
calls `table-recognize-table'."
:group 'org-table-editing
:type 'boolean)
(defgroup org-link nil
"Options concerning links in Org-mode."
:tag "Org Link"
:group 'org)
(defvar org-link-abbrev-alist-local nil
"Buffer-local version of `org-link-abbrev-alist', which see.
The value of this is taken from the #+LINK lines.")
(make-variable-buffer-local 'org-link-abbrev-alist-local)
(defcustom org-link-abbrev-alist nil
"Alist of link abbreviations.
The car of each element is a string, to be replaced at the start of a link.
The cdrs are replacement values, like (\"linkkey\" . REPLACE). Abbreviated
links in Org-mode buffers can have an optional tag after a double colon, e.g.
The 'linkkey' must be a word word, starting with a letter, followed
by letters, numbers, '-' or '_'.
If REPLACE is a string, the tag will simply be appended to create the link.
If the string contains \"%s\", the tag will be inserted there. If the string
contains \"%h\", it will cause a url-encoded version of the tag to be inserted
at that point (see the function `url-hexify-string'). If the string contains
the specifier \"%(my-function)\", then the custom function `my-function' will
be invoked: this function takes the tag as its only argument and must return
a string.
REPLACE may also be a function that will be called with the tag as the
only argument to create the link, which should be returned as a string.
See the manual for examples."
:group 'org-link
:type '(repeat
(string :tag "Protocol")
(string :tag "Format")
(defcustom org-descriptive-links t
"Non-nil means Org will display descriptive links.
E.g. [[][Org website]] will be displayed as
\"Org Website\", hiding the link itself and just displaying its
description. When set to `nil', Org will display the full links
You can interactively set the value of this variable by calling
`org-toggle-link-display' or from the menu Org>Hyperlinks menu."
:group 'org-link
:type 'boolean)
(defcustom org-link-file-path-type 'adaptive
"How the path name in file links should be stored.
Valid values are:
relative Relative to the current directory, i.e. the directory of the file
into which the link is being inserted.
absolute Absolute path, if possible with ~ for home directory.
noabbrev Absolute path, no abbreviation of home directory.
adaptive Use relative path for files in the current directory and sub-
directories of it. For other files, use an absolute path."
:group 'org-link
:type '(choice
(const relative)
(const absolute)
(const noabbrev)
(const adaptive)))
(defcustom org-activate-links '(bracket angle plain radio tag date footnote)
"Types of links that should be activated in Org-mode files.
This is a list of symbols, each leading to the activation of a certain link
type. In principle, it does not hurt to turn on most 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
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.
Changing this variable requires a restart of Emacs to become effective."
:group 'org-link
: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-make-link-description-function nil
"Function to use for generating link descriptions from links.
When nil, the link location will be used. This function must take
two parameters: the first one is the link, the second one is the
description generated by `org-insert-link'. The function should
return the description to use."
:group 'org-link
:type '(choice (const nil) (function)))
(defgroup org-link-store nil
"Options concerning storing links in Org-mode."
:tag "Org Store Link"
:group 'org-link)
(defcustom org-url-hexify-p t
"When non-nil, hexify URL when creating a link."
:type 'boolean
:version "24.3"
:group 'org-link-store)
(defcustom org-email-link-description-format "Email %c: %.30s"
"Format of the description part of a link to an email or usenet message.
The following %-escapes will be replaced by corresponding information:
%F full \"From\" field
%f name, taken from \"From\" field, address if no name
%T full \"To\" field
%t first name in \"To\" field, address if no name
%c correspondent. Usually \"from NAME\", but if you sent it yourself, it
will be \"to NAME\". See also the variable `org-from-is-user-regexp'.
%s subject
%d date
%m message-id.
You may use normal field width specification between the % and the letter.
This is for example useful to limit the length of the subject.
Examples: \"%f on: %.30s\", \"Email from %f\", \"Email %c\""
:group 'org-link-store
:type 'string)
(defcustom org-from-is-user-regexp
(let (r1 r2)
(when (and user-mail-address (not (string= user-mail-address "")))
(setq r1 (concat "\\<" (regexp-quote user-mail-address) "\\>")))
(when (and user-full-name (not (string= user-full-name "")))
(setq r2 (concat "\\<" (regexp-quote user-full-name) "\\>")))
(if (and r1 r2) (concat r1 "\\|" r2) (or r1 r2)))
"Regexp matched against the \"From:\" header of an email or usenet message.
It should match if the message is from the user him/herself."
:group 'org-link-store
:type 'regexp)
(defcustom org-context-in-file-links t
"Non-nil means file links from `org-store-link' contain context.
A search string will be added to the file name with :: as separator and
used to find the context when the link is activated by the command
`org-open-at-point'. When this option is t, the entire active region
will be placed in the search string of the file link. If set to a
positive integer, only the first n lines of context will be stored.
Using a prefix arg to the command \\[org-store-link] (`org-store-link')
negates this setting for the duration of the command."
:group 'org-link-store
:type '(choice boolean integer))
(defcustom org-keep-stored-link-after-insertion nil
"Non-nil means keep link in list for entire session.
The command `org-store-link' adds a link pointing to the current
location to an internal list. These links accumulate during a session.
The command `org-insert-link' can be used to insert links into any
Org-mode file (offering completion for all stored links). When this
option is nil, every link which has been inserted once using \\[org-insert-link]
will be removed from the list, to make completing the unused links
more efficient."
:group 'org-link-store
:type 'boolean)
(defgroup org-link-follow nil
"Options concerning following links in Org-mode."
:tag "Org Follow Link"
:group 'org-link)
(defcustom org-link-translation-function nil
"Function to translate links with different syntax to Org syntax.
This can be used to translate links created for example by the Planner
or emacs-wiki packages to Org syntax.
The function must accept two parameters, a TYPE containing the link
protocol name like \"rmail\" or \"gnus\" as a string, and the linked path,
which is everything after the link protocol. It should return a cons
with possibly modified values of type and path.
Org contains a function for this, so if you set this variable to
`org-translate-link-from-planner', you should be able follow many
links created by planner."
:group 'org-link-follow
:type '(choice (const nil) (function)))
(defcustom org-follow-link-hook nil
"Hook that is run after a link has been followed."
:group 'org-link-follow
:type 'hook)
(defcustom org-tab-follows-link nil
"Non-nil means on links TAB will follow the link.
Needs to be set before org.el is loaded.
This really should not be used, it does not make sense, and the
implementation is bad."
:group 'org-link-follow
:type 'boolean)
(defcustom org-return-follows-link nil
"Non-nil means on links RET will follow the link.
In tables, the special behavior of RET has precedence."
:group 'org-link-follow
:type 'boolean)
(defcustom org-mouse-1-follows-link
(if (boundp 'mouse-1-click-follows-link) mouse-1-click-follows-link t)
"Non-nil means mouse-1 on a link will follow the link.
A longer mouse click will still set point. Does not work on XEmacs.
Needs to be set before org.el is loaded."
:group 'org-link-follow
:version "24.4"
:package-version '(Org . "8.3")
:type '(choice
(const :tag "A double click follows the link" double)
(const :tag "Unconditionally follow the link with mouse-1" t)
(integer :tag "mouse-1 click does not follow the link if longer than N ms" 450)))
(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)
(defcustom org-link-search-must-match-exact-headline 'query-to-create
"Non-nil means internal links in Org files must exactly match a headline.
When nil, the link search tries to match a phrase with all words
in the search text."
:group 'org-link-follow
:version "24.1"
:type '(choice
(const :tag "Use fuzzy text search" nil)
(const :tag "Match only exact headline" t)
(const :tag "Match exact headline or query to create it"
(defcustom org-link-frame-setup
'((vm . vm-visit-folder-other-frame)
(vm-imap . vm-visit-imap-folder-other-frame)
(gnus . org-gnus-no-new-news)
(file . find-file-other-window)
(wl . wl-other-frame))
"Setup the frame configuration for following links.
When following a link with Emacs, it may often be useful to display
this link in another window or frame. This variable can be used to
set this up for the different types of links.
For VM, use any of
For Gnus, use any of
For FILE, use any of
For Wanderlust use any of
For the calendar, use the variable `calendar-setup'.
For BBDB, it is currently only possible to display the matches in
another window."
:group 'org-link-follow
:type '(list
(cons (const vm)
(const vm-visit-folder)
(const vm-visit-folder-other-window)
(const vm-visit-folder-other-frame)))
(cons (const vm-imap)
(const vm-visit-imap-folder)
(const vm-visit-imap-folder-other-window)
(const vm-visit-imap-folder-other-frame)))
(cons (const gnus)
(const gnus)
(const gnus-other-frame)
(const org-gnus-no-new-news)))
(cons (const file)
(const find-file)
(const find-file-other-window)
(const find-file-other-frame)))
(cons (const wl)
(const wl)
(const wl-other-frame)))))
(defcustom org-display-internal-link-with-indirect-buffer nil
"Non-nil means use indirect buffer to display infile links.
Activating internal links (from one location in a file to another location
in the same file) normally just jumps to the location. When the link is
activated with a \\[universal-argument] prefix (or with mouse-3), the link \
is displayed in
another window. When this option is set, the other window actually displays
an indirect buffer clone of the current buffer, to avoid any visibility
changes to the current buffer."
:group 'org-link-follow
:type 'boolean)
(defcustom org-open-non-existing-files nil
"Non-nil means `org-open-file' will open non-existing files.
When nil, an error will be generated.
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-link-follow
:type 'boolean)
(defcustom org-open-directory-means-index-dot-org nil
"Non-nil means a link to a directory really means to
When nil, following a directory link will run dired or open a finder/explorer
window on that directory."
:group 'org-link-follow
:type 'boolean)
(defcustom org-link-mailto-program '(browse-url "mailto:%a?subject=%s")
"Function and arguments to call for following mailto links.
This is a list with the first element being a Lisp function, and the
remaining elements being arguments to the function. In string arguments,
%a will be replaced by the address, and %s will be replaced by the subject
if one was given like in < subject>."
:group 'org-link-follow
:type '(choice
(const :tag "browse-url" (browse-url-mail "mailto:%a?subject=%s"))
(const :tag "compose-mail" (compose-mail "%a" "%s"))
(const :tag "message-mail" (message-mail "%a" "%s"))
(cons :tag "other" (function) (repeat :tag "argument" sexp))))
(defcustom org-confirm-shell-link-function 'yes-or-no-p
"Non-nil means ask for confirmation before executing shell links.
Shell links can be dangerous: just think about a link
[[shell:rm -rf ~/*][Google Search]]
This link would show up in your Org-mode document as \"Google Search\",
but really it would remove your entire home directory.
Therefore we advise against setting this variable to nil.
Just change it to `y-or-n-p' if you want to confirm with a
single keystroke rather than having to type \"yes\"."
:group 'org-link-follow
:type '(choice
(const :tag "with yes-or-no (safer)" yes-or-no-p)
(const :tag "with y-or-n (faster)" y-or-n-p)
(const :tag "no confirmation (dangerous)" nil)))
(put 'org-confirm-shell-link-function
#'(lambda (x) (member x '(yes-or-no-p y-or-n-p))))
(defcustom org-confirm-shell-link-not-regexp ""
"A regexp to skip confirmation for shell links."
:group 'org-link-follow
:version "24.1"
:type 'regexp)
(defcustom org-confirm-elisp-link-function 'yes-or-no-p
"Non-nil means ask for confirmation before executing Emacs Lisp links.
Elisp links can be dangerous: just think about a link
[[elisp:(shell-command \"rm -rf ~/*\")][Google Search]]
This link would show up in your Org-mode document as \"Google Search\",
but really it would remove your entire home directory.
Therefore we advise against setting this variable to nil.
Just change it to `y-or-n-p' if you want to confirm with a
single keystroke rather than having to type \"yes\"."
:group 'org-link-follow
:type '(choice
(const :tag "with yes-or-no (safer)" yes-or-no-p)
(const :tag "with y-or-n (faster)" y-or-n-p)
(const :tag "no confirmation (dangerous)" nil)))
(put 'org-confirm-shell-link-function
#'(lambda (x) (member x '(yes-or-no-p y-or-n-p))))
(defcustom org-confirm-elisp-link-not-regexp ""
"A regexp to skip confirmation for Elisp links."
:group 'org-link-follow
:version "24.1"
:type 'regexp)
(defconst org-file-apps-defaults-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-defaults-macosx
'((remote . emacs)
(t . "open %s")
(system . "open %s")
("ps.gz" . "gv %s")
("eps.gz" . "gv %s")
("dvi" . "xdvi %s")
("fig" . "xfig %s"))
"Default file applications on a MacOS X 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-defaults-windowsnt
'(remote . emacs)
(cons t
(list (if (featurep 'xemacs)
"open" 'file))
(cons 'system
(list (if (featurep 'xemacs)
"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)
("\\.mm\\'" . default)
("\\.x?html?\\'" . default)
("\\.pdf\\'" . default))
"External applications for opening `file:path' items in a document.
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 lisp form, you can access the group matches with
(match-string n link).
Example: (\"\\.pdf::\\(\\d+\\)\\'\" . \"evince -p %1 %s\")
to open [[file:document.pdf::5]] with evince at page 5.
`directory' Matches a directory
`remote' Matches a remote file, accessible through tramp or efs.
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.
t Default for files not matched by any of the other options.
`system' The system command to open files, like `open' on Windows
and Mac OS X, and mailcap under GNU/Linux. This is the command
that will be selected if you call `C-c C-o' with a double
\\[universal-argument] \\[universal-argument] prefix.
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
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
string A command to be executed by a shell; %s will be replaced
by the path to the file.
sexp A Lisp form which will be evaluated. The file path will
be available in the Lisp variable `file'.
For more examples, see the system specific constants
:group 'org-link-follow
: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"
(choice :value ""
(const :tag "Visit with Emacs" emacs)
(const :tag "Use default" default)
(const :tag "Use the system command" system)
(string :tag "Command")
(sexp :tag "Lisp form")))))
(defcustom org-doi-server-url ""
"The URL of the DOI server."
:type 'string
:version "24.3"
:group 'org-link-follow)
(defgroup org-refile nil
"Options concerning refiling entries in Org-mode."
:tag "Org Refile"
:group 'org)
(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 only 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
2. When a capture note is filed away in an interactive way (when exiting the
note buffer with `C-1 C-c C-c'. The user is prompted for an org file,
with `org-directory' as the default path."
: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 '(choice
(const :tag "Default from remember-data-file" nil)
(defcustom org-goto-interface 'outline
"The default interface to be used for `org-goto'.
Allowed values are:
outline The interface shows an outline of the relevant file
and the correct heading is found by moving through
the outline or by searching with incremental search.
outline-path-completion Headlines in the current buffer are offered via
completion. This is the interface also used by
the refile command."
:group 'org-refile
:type '(choice
(const :tag "Outline" outline)
(const :tag "Outline-path-completion" outline-path-completion)))
(defcustom org-goto-max-level 5
"Maximum target level when running `org-goto' with refile interface."
:group 'org-refile
:type 'integer)
(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))))
(defcustom org-log-refile nil
"Information to record when a task is refiled.
Possible values are:
nil Don't add anything
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: nologrefile
#+STARTUP: logrefile
#+STARTUP: lognoterefile
You can have local logging settings for a subtree by setting the LOGGING
property to one or more of these keywords.
When bulk-refiling from the agenda, the value `note' is forbidden and
will temporarily be changed to `time'."
:group 'org-refile
:group 'org-progress
:version "24.1"
:type '(choice
(const :tag "No logging" nil)
(const :tag "Record timestamp" time)
(const :tag "Record timestamp with note." note)))
(defcustom org-refile-targets nil
"Targets for refiling entries with \\[org-refile].
This is a list of cons cells. Each cell contains:
- a specification of the files to be considered, either a list of files,
or a symbol whose function or variable value will be used to retrieve
a file name or a list of file names. If you use `org-agenda-files' for
that, all agenda files will be scanned for targets. Nil means consider
headings in the current buffer.
- A specification of how to find candidate refile targets. This may be
any of:
- a cons cell (:tag . \"TAG\") to identify refile targets by a tag.
This tag has to be present in all target headlines, inheritance will
not be considered.
- a cons cell (:todo . \"KEYWORD\") to identify refile targets by
todo keyword.
- a cons cell (:regexp . \"REGEXP\") with a regular expression matching
headlines that are refiling targets.
- a cons cell (:level . N). Any headline of level N is considered a target.
Note that, when `org-odd-levels-only' is set, level corresponds to
order in hierarchy, not to the number of stars.
- a cons cell (:maxlevel . N). Any headline with level <= N is a target.
Note that, when `org-odd-levels-only' is set, level corresponds to
order in hierarchy, not to the number of stars.
Each element of this list generates a set of possible targets.
The union of these sets is presented (with completion) to
the user by `org-refile'.
You can set the variable `org-refile-target-verify-function' to a function
to verify each headline found by the simple criteria above.
When this variable is nil, all top-level headlines in the current buffer
are used, equivalent to the value `((nil . (:level . 1))'."
:group 'org-refile
:type '(repeat
(choice :value org-agenda-files
(const :tag "All agenda files" org-agenda-files)
(const :tag "Current buffer" nil)
(function) (variable) (file))
(choice :tag "Identify target headline by"
(cons :tag "Specific tag" (const :value :tag) (string))
(cons :tag "TODO keyword" (const :value :todo) (string))
(cons :tag "Regular expression" (const :value :regexp) (regexp))
(cons :tag "Level number" (const :value :level) (integer))
(cons :tag "Max Level number" (const :value :maxlevel) (integer))))))
(defcustom org-refile-target-verify-function nil
"Function to verify if the headline at point should be a refile target.
The function will be called without arguments, with point at the
beginning of the headline. It should return t and leave point
where it is if the headline is a valid target for refiling.
If the target should not be selected, the function must return nil.
In addition to this, it may move point to a place from where the search
should be continued. For example, the function may decide that the entire
subtree of the current entry should be excluded and move point to the end
of the subtree."
:group 'org-refile
:type '(choice
(const nil)
(defcustom org-refile-use-cache nil
"Non-nil means cache refile targets to speed up the process.
The cache for a particular file will be updated automatically when
the buffer has been killed, or when any of the marker used for flagging
refile targets no longer points at a live buffer.
If you have added new entries to a buffer that might themselves be targets,
you need to clear the cache manually by pressing `C-0 C-c C-w' or, if you
find that easier, `C-u C-u C-u C-c C-w'."
:group 'org-refile
:version "24.1"
:type 'boolean)
(defcustom org-refile-use-outline-path nil
"Non-nil means provide refile targets as paths.
So a level 3 headline will be available as level1/level2/level3.
When the value is `file', also include the file name (without directory)
into the path. In this case, you can also stop the completion after
the file name, to get entries inserted as top level in the file.
When `full-file-path', include the full file path."
:group 'org-refile
:type '(choice
(const :tag "Not" nil)
(const :tag "Yes" t)
(const :tag "Start with file name" file)
(const :tag "Start with full file path" full-file-path)))
(defcustom org-outline-path-complete-in-steps t
"Non-nil means complete the outline path in hierarchical steps.
When Org-mode uses the refile interface to select an outline path
\(see variable `org-refile-use-outline-path'), the completion of
the path can be done is a single go, or if can be done in steps down
the headline hierarchy. Going in steps is probably the best if you
do not use a special completion package like `ido' or `icicles'.
However, when using these packages, going in one step can be very
fast, while still showing the whole path to the entry."
:group 'org-refile
:type 'boolean)
(defcustom org-refile-allow-creating-parent-nodes nil
"Non-nil means allow to create new nodes as refile targets.
New nodes are then created by adding \"/new node name\" to the completion
of an existing node. When the value of this variable is `confirm',
new node creation must be confirmed by the user (recommended).
When nil, the completion must match an existing entry.
Note that, if the new heading is not seen by the criteria
listed in `org-refile-targets', multiple instances of the same
heading would be created by trying again to file under the new
:group 'org-refile
:type '(choice
(const :tag "Never" nil)
(const :tag "Always" t)
(const :tag "Prompt for confirmation" confirm)))
(defcustom org-refile-active-region-within-subtree nil
"Non-nil means also refile active region within a subtree.
By default `org-refile' doesn't allow refiling regions if they
don't contain a set of subtrees, but it might be convenient to
do so sometimes: in that case, the first line of the region is
converted to a headline before refiling."
:group 'org-refile
:version "24.1"
:type 'boolean)
(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-mode 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"
:tag "Interpretation"
;;Quick and dirty way to see
;;`org-todo-interpretations'. This takes the
;;place of item arguments
(lambda (widget)
(widget-put widget
:args (mapcar
#'(lambda (x)
(cons 'const x)))
(string :tag "Keyword"))))))
(defvar org-todo-keywords-1 nil
"All TODO and DONE keywords active in a buffer.")
(make-variable-buffer-local 'org-todo-keywords-1)
(defvar org-todo-keywords-for-agenda nil)
(defvar org-done-keywords-for-agenda nil)
(defvar org-drawers-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 org-tag-groups-alist nil)
(make-variable-buffer-local 'org-tag-groups-alist)
(defvar org-agenda-contributing-files nil)
(defvar org-not-done-keywords nil)
(make-variable-buffer-local 'org-not-done-keywords)
(defvar org-done-keywords nil)
(make-variable-buffer-local 'org-done-keywords)
(defvar org-todo-heads nil)
(make-variable-buffer-local 'org-todo-heads)
(defvar org-todo-sets nil)
(make-variable-buffer-local 'org-todo-sets)
(defvar org-todo-log-states nil)
(make-variable-buffer-local 'org-todo-log-states)
(defvar org-todo-kwd-alist nil)
(make-variable-buffer-local 'org-todo-kwd-alist)
(defvar org-todo-key-alist nil)
(make-variable-buffer-local 'org-todo-key-alist)
(defvar org-todo-key-trigger nil)
(make-variable-buffer-local 'org-todo-key-trigger)
(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 t
"Non-nil means use the fast todo selection scheme with C-c C-t.
This variable describes if and under what circumstances the cycling
mechanism for TODO keywords will be replaced by a single-key, direct
selection scheme.
When nil, fast selection is never used.
When the symbol `prefix', it will be used when `org-todo' is called
with a prefix argument, i.e. `C-u C-c C-t' in an Org-mode buffer, and
`C-u t' in an agenda buffer.
When t, fast selection is used by default. In this case, the prefix
argument forces cycling instead.
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
:type '(choice
(const :tag "Never" nil)
(const :tag "By default" t)
(const :tag "Only with C-u C-c C-t" prefix)))
(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 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"))
(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 var val)
(if val
(add-hook 'org-blocker-hook
(remove-hook 'org-blocker-hook
: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 is while Emacs is running is through the customize interface."
:set (lambda (var val)
(set var val)
(if val
(add-hook 'org-blocker-hook
(remove-hook 'org-blocker-hook
: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"))
(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.
((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 tasks 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"
: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 tasks 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."
: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.
%t in the heading will be replaced by a time stamp.
%T will be an active time stamp instead the default inactive one
%d will be replaced by a short-format time stamp.
%D will be replaced by an active short-format time stamp.
%s will be replaced by the new TODO state, in double quotes.
%S will be replaced by the old TODO state, in double quotes.
%u will be replaced by the user name.
%U will be replaced by the 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))
(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."
:group 'org-todo
:group 'org-progress
:type '(choice
(const :tag "Not into a drawer" nil)
(const :tag "LOGBOOK" t)
(string :tag "Other")))
(org-defvaralias 'org-log-state-notes-into-drawer 'org-log-into-drawer)
(defun org-log-into-drawer ()
"Return the value of `org-log-into-drawer', but let properties overrule.
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)))
((not p) org-log-into-drawer)
((equal p "nil") nil)
((equal p "t") "LOGBOOK")
(t p))))
(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
: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 in a TODO sequence, or the previous state
in a TODO_TYP set. But you can specify another task here.
alternatively, set the :REPEAT_TO_STATE: property of the entry."
:group 'org-todo
:version "24.1"
:type '(choice (const :tag "Head of sequence" nil)
(string :tag "Specific 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)))
(defgroup org-priorities nil
"Priorities in Org-mode."
:tag "Org Priorities"
:group 'org-todo)
(defcustom org-enable-priority-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)
(defcustom org-highest-priority ?A
"The highest priority of TODO items. A character like ?A, ?B etc.
Must have a smaller ASCII number than `org-lowest-priority'."
:group 'org-priorities
:type 'character)
(defcustom org-lowest-priority ?C
"The lowest priority of TODO items. A character like ?A, ?B etc.
Must have a larger ASCII number than `org-highest-priority'."
:group 'org-priorities
:type 'character)
(defcustom org-default-priority ?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-highest-priority' to
`org-lowest-priority' which means that `org-default-priority' has to be
in this range exclusive or inclusive the range boundaries. Else the
first step refuses to set the default and the second will fall back
to (depending on the command used) the highest or lowest priority."
:group 'org-priorities
:type 'character)
(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-default-priority'."
:group 'org-priorities
:type 'boolean)
(defcustom org-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)
(defgroup org-time nil
"Options concerning time stamps and deadlines in Org-mode."
:tag "Org Time"
:group 'org)
(defcustom org-insert-labeled-timestamps-at-point nil
"Non-nil means SCHEDULED and DEADLINE timestamps are inserted at point.
When nil, these labeled time stamps are forces into the second line of an
entry, just after the headline. When scheduling from the global TODO list,
the time stamp will always be forced into the second line."
:group 'org-time
:type 'boolean)
(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.
It is not recommended to change this constant.")
(defcustom org-time-stamp-rounding-minutes '(0 5)
"Number of minutes to round time stamps to.
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 `C-c .' or `C-c !',
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
(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
:set 'set-default
: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."
:group 'org-time
:type 'sexp)
(defun org-time-stamp-format (&optional long inactive)
"Get the right format for a time string."
(let ((f (if long (cdr org-time-stamp-formats)
(car org-time-stamp-formats))))
(if inactive
(concat "[" (substring f 1 -1) "]")
(defcustom org-time-clocksum-format
'(:days "%dd " :hours "%d" :require-hours t :minutes ":%02d" :require-minutes t)
"The format string used when creating CLOCKSUM lines.
This is also used when Org mode generates a time duration.
The value can be a single format string containing two
%-sequences, which will be filled with the number of hours and
minutes in that order.
Alternatively, the value can be a plist associating any of the
keys :years, :months, :weeks, :days, :hours or :minutes with
format strings. The time duration is formatted using only the
time components that are needed and concatenating the results.
If a time unit in absent, it falls back to the next smallest
The keys :require-years, :require-months, :require-days,
:require-weeks, :require-hours, :require-minutes are also
meaningful. A non-nil value for these keys indicates that the
corresponding time component should always be included, even if
its value is 0.
For example,
\(:days \"%dd\" :hours \"%d\" :require-hours t :minutes \":%02d\"
:require-minutes t)
means durations longer than a day will be expressed in days,
hours and minutes, and durations less than a day will always be
expressed in hours and minutes (even for durations less than an
The value
\(:days \"%dd\" :minutes \"%dm\")
means durations longer than a day will be expressed in days and
minutes, and durations less than a day will be expressed entirely
in minutes (even for durations longer than an hour)."
:group 'org-time
:group 'org-clock
:version "24.4"
:package-version '(Org . "8.0")
:type '(choice (string :tag "Format string")
(set :tag "Plist"
(group :inline t (const :tag "Years" :years)
(string :tag "Format string"))
(group :inline t
(const :tag "Always show years" :require-years)
(const t))
(group :inline t (const :tag "Months" :months)
(string :tag "Format string"))
(group :inline t
(const :tag "Always show months" :require-months)
(const t))
(group :inline t (const :tag "Weeks" :weeks)
(string :tag "Format string"))
(group :inline t
(const :tag "Always show weeks" :require-weeks)
(const t))
(group :inline t (const :tag "Days" :days)
(string :tag "Format string"))
(group :inline t
(const :tag "Always show days" :require-days)
(const t))
(group :inline t (const :tag "Hours" :hours)
(string :tag "Format string"))
(group :inline t
(const :tag "Always show hours" :require-hours)
(const t))
(group :inline t (const :tag "Minutes" :minutes)
(string :tag "Format string"))
(group :inline t
(const :tag "Always show minutes" :require-minutes)
(const t)))))
(defcustom org-time-clocksum-use-fractional nil
"When non-nil, \\[org-clock-display] uses fractional times.
See `org-time-clocksum-format' for more on time clock formats."
:group 'org-time
:group 'org-clock
:version "24.3"
:type 'boolean)
(defcustom org-time-clocksum-use-effort-durations nil
"When non-nil, \\[org-clock-display] uses effort durations.
E.g. by default, one day is considered to be a 8 hours effort,
so a task that has been clocked for 16 hours will be displayed
as during 2 days in the clock display or in the clocktable.
See `org-effort-durations' on how to set effort durations
and `org-time-clocksum-format' for more on time clock formats."
:group 'org-time
:group 'org-clock
:version "24.4"
:package-version '(Org . "8.0")
:type 'boolean)
(defcustom org-time-clocksum-fractional-format "%.2f"
"The format string used when creating CLOCKSUM lines,
or when Org mode generates a time duration, if
`org-time-clocksum-use-fractional' is enabled.
The value can be a single format string containing one
%-sequence, which will be filled with the number of hours as
a float.
Alternatively, the value can be a plist associating any of the
keys :years, :months, :weeks, :days, :hours or :minutes with
a format string. The time duration is formatted using the
largest time unit which gives a non-zero integer part. If all
specified formats have zero integer part, the smallest time unit
is used."
:group 'org-time
:type '(choice (string :tag "Format string")
(set (group :inline t (const :tag "Years" :years)
(string :tag "Format string"))
(group :inline t (const :tag "Months" :months)
(string :tag "Format string"))
(group :inline t (const :tag "Weeks" :weeks)
(string :tag "Format string"))
(group :inline t (const :tag "Days" :days)
(string :tag "Format string"))
(group :inline t (const :tag "Hours" :hours)
(string :tag "Format string"))
(group :inline t (const :tag "Minutes" :minutes)
(string :tag "Format string")))))
(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
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-mode 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 time" time)))
(defcustom org-agenda-jump-prefer-future 'org-read-date-prefer-future
"Should the agenda jump command prefer the future for incomplete dates?
The default is to do the same as configured in `org-read-date-prefer-future'.
But you can also set a deviating value here.
This may t or nil, or the symbol `org-read-date-prefer-future'."
:group 'org-agenda
:group 'org-time
:version "24.1"
:type '(choice
(const :tag "Use org-read-date-prefer-future"
(const :tag "Never" nil)
(const :tag "Always" t)))
(defcustom org-read-date-force-compatible-dates t
"Should date/time prompt force dates that are guaranteed to work in Emacs?
Depending on the system Emacs is running on, certain dates cannot
be represented with the type used internally to represent time.
Dates between 1970-1-1 and 2038-1-1 can always be represented
correctly. Some systems allow for earlier dates, some for later,
some for both. One way to find out it to insert any date into an
Org buffer, putting the cursor on the year and hitting S-up and
S-down to test the range.
When this variable is set to t, the date/time prompt will not let
you specify dates outside the 1970-2037 range, so it is certain that
these dates will work in whatever version of Emacs you are
running, and also that you can move a file from one Emacs implementation
to another. WHenever Org is forcing the year for you, it will display
a message and beep.
When this variable is nil, Org will check if the date is
representable in the specific Emacs implementation you are using.
If not, it will force a year, usually the current year, and beep
to remind you. Currently this setting is not recommended because
the likelihood that you will open your Org files in an Emacs that
has limited date range is not negligible.
A workaround for this problem is to use diary sexp dates for time
stamps outside of this range."
:group 'org-time
:version "24.1"
:type 'boolean)
(defcustom org-read-date-display-live t
"Non-nil means display current interpretation of date prompt live.
This display will be in an overlay, in the minibuffer."
:group 'org-time
:type 'boolean)
(defcustom org-read-date-popup-calendar t
"Non-nil means pop up a calendar when prompting for a date.
In the calendar, the date can be selected with mouse-1. However, the
minibuffer will also be active, and you can simply enter the date as well.
When nil, only the minibuffer will be available."
:group 'org-time
:type 'boolean)
(org-defvaralias 'org-popup-calendar-for-date-prompt
"Set `org-read-date-minibuffer-local-map' instead." "24.4")
(defcustom org-read-date-minibuffer-setup-hook nil
"Hook to be used to set up keys for the date/time interface.
Add key definitions to `minibuffer-local-map', which will be a
temporary copy.
WARNING: This option is obsolete, you should use
`org-read-date-minibuffer-local-map' to set up keys."
:group 'org-time
:type 'hook)
(defcustom org-extend-today-until 0
"The hour when your day really ends. Must be an integer.
This has influence for the following applications:
- When switching the agenda to \"today\". It it is still earlier than
the time given here, the day recognized as TODAY is actually yesterday.
- When a date is read from the user and it is still before the time given
here, the current date and time will be assumed to be yesterday, 23:59.
Also, timestamps inserted in capture templates follow this rule.
IMPORTANT: This is a feature whose implementation is and likely will
remain incomplete. Really, it is only here because past midnight seems to
be the favorite working time of John Wiegley :-)"
:group 'org-time
:type 'integer)
(defcustom org-use-effective-time nil
"If non-nil, consider `org-extend-today-until' when creating timestamps.
For example, if `org-extend-today-until' is 8, and it's 4am, then the
\"effective time\" of any timestamps between midnight and 8am will be
23:59 of the previous day."
:group 'org-time
:version "24.1"
:type 'boolean)
(defcustom org-use-last-clock-out-time-as-effective-time nil
"When non-nil, use the last clock out time for `org-todo'.
Note that this option has precedence over the combined use of
`org-use-effective-time' and `org-extend-today-until'."
:group 'org-time
:version "24.4"
:package-version '(Org . "8.0")
:type 'boolean)
(defcustom org-edit-timestamp-down-means-later nil
"Non-nil means S-down will increase the time in a time stamp.
When nil, S-up will increase."
:group 'org-time
:type 'boolean)
(defcustom org-calendar-follow-timestamp-change t
"Non-nil means make the calendar window follow timestamp changes.
When a timestamp is modified and the calendar window is visible, it will be
moved to the new date."
:group 'org-time
:type 'boolean)
(defgroup org-tags nil
"Options concerning tags in Org-mode."
:tag "Org Tags"
:group 'org)
(defcustom org-tag-alist nil
"List of tags allowed in Org-mode files.
When this list is nil, Org-mode will base TAG input on what is already in the
The value of this variable is an alist, the car of each entry must be a
keyword as a string, the cdr may be a character that is used to select
that tag through the fast-tag-selection interface.
See the manual for details."
:group 'org-tags
:type '(repeat
(cons (string :tag "Tag name")
(character :tag "Access char"))
(list :tag "Start radio group"
(const :startgroup)
(option (string :tag "Group description")))
(list :tag "Group tags delimiter"
(const :grouptags))
(list :tag "End radio group"
(const :endgroup)
(option (string :tag "Group description")))
(const :tag "New line" (:newline)))))
(defcustom org-tag-persistent-alist nil
"List of tags that will always appear in all Org-mode files.
This is in addition to any in buffer settings or customizations
of `org-tag-alist'.
When this list is nil, Org-mode will base TAG input on `org-tag-alist'.
The value of this variable is an alist, the car of each entry must be a
keyword as a string, the cdr may be a character that is used to select
that tag through the fast-tag-selection interface.
See the manual for details.
To disable these tags on a per-file basis, insert anywhere in the file:
#+STARTUP: noptag"
:group 'org-tags
:type '(repeat
(cons (string :tag "Tag name")
(character :tag "Access char"))
(const :tag "Start radio group" (:startgroup))
(const :tag "Group tags delimiter" (:grouptags))
(const :tag "End radio group" (:endgroup))
(const :tag "New line" (:newline)))))
(defcustom org-complete-tags-always-offer-all-agenda-tags nil
"If non-nil, always offer completion for all tags of all agenda files.
Instead of customizing this variable directly, you might want to
set it locally for capture buffers, because there no list of
tags in that file can be created dynamically (there are none).
(add-hook 'org-capture-mode-hook
(lambda ()
(set (make-local-variable
:group 'org-tags
:version "24.1"
:type 'boolean)
(defvar org-file-tags nil
"List of tags that can be inherited by all entries in the file.
The tags will be inherited if the variable `org-use-tag-inheritance'
says they should be.
This variable is populated from #+FILETAGS lines.")
(defcustom org-use-fast-tag-selection 'auto
"Non-nil means use fast tag selection scheme.
This is a special interface to select and deselect tags with single keys.
When nil, fast selection is never used.
When the symbol `auto', fast selection is used if and only if selection
characters for tags have been configured, either through the variable
`org-tag-alist' or through a #+TAGS line in the buffer.
When t, fast selection is always used and selection keys are assigned
automatically if necessary."
:group 'org-tags
:type '(choice
(const :tag "Always" t)
(const :tag "Never" nil)
(const :tag "When selection characters are configured" auto)))
(defcustom org-fast-tag-selection-single-key nil
"Non-nil means fast tag selection exits after first change.
When nil, you have to press RET to exit it.
During fast tag selection, you can toggle this flag with `C-c'.
This variable can also have the value `expert'. In this case, the window
displaying the tags menu is not even shown, until you press C-c again."
:group 'org-tags
:type '(choice
(const :tag "No" nil)
(const :tag "Yes" t)
(const :tag "Expert" expert)))
(defvar org-fast-tag-selection-include-todo nil
"Non-nil means fast tags selection interface will also offer TODO states.
This is an undocumented feature, you should not rely on it.")
(defcustom org-tags-column (if (featurep 'xemacs) -76 -77)
"The column to which tags should be indented in a headline.
If this number is positive, it specifies the column. If it is negative,
it means that the tags should be flushright to that column. For example,
-80 works well for a normal 80 character screen.
When 0, place tags directly after headline text, with only one space in
:group 'org-tags
:type 'integer)
(defcustom org-auto-align-tags t
"Non-nil keeps tags aligned when modifying headlines.
Some operations (i.e. demoting) change the length of a headline and
therefore shift the tags around. With this option turned on, after
each such operation the tags are again aligned to `org-tags-column'."
:group 'org-tags
:type 'boolean)
(defcustom org-use-tag-inheritance t
"Non-nil means tags in levels apply also for sublevels.
When nil, only the tags directly given in a specific line apply there.
This may also be a list of tags that should be inherited, or a regexp that
matches tags that should be inherited. Additional control is possible
with the variable `org-tags-exclude-from-inheritance' which gives an
explicit list of tags to be excluded from inheritance, even if the value of
`org-use-tag-inheritance' would select it for inheritance.
If this option is t, a match early-on in a tree can lead to a large
number of matches in the subtree when constructing the agenda or creating
a sparse tree. If you only want to see the first match in a tree during
a search, check out the variable `org-tags-match-list-sublevels'."
:group 'org-tags
:type '(choice
(const :tag "Not" nil)
(const :tag "Always" t)
(repeat :tag "Specific tags" (string :tag "Tag"))
(regexp :tag "Tags matched by regexp")))
(defcustom org-tags-exclude-from-inheritance nil
"List of tags that should never be inherited.
This is a way to exclude a few tags from inheritance. For way to do
the opposite, to actively allow inheritance for selected tags,
see the variable `org-use-tag-inheritance'."
:group 'org-tags
:type '(repeat (string :tag "Tag")))
(defun org-tag-inherit-p (tag)
"Check if TAG is one that should be inherited."
((member tag org-tags-exclude-from-inheritance) nil)
((eq org-use-tag-inheritance t) t)
((not org-use-tag-inheritance) nil)
((stringp org-use-tag-inheritance)
(string-match org-use-tag-inheritance tag))
((listp org-use-tag-inheritance)
(member tag org-use-tag-inheritance))
(t (error "Invalid setting of `org-use-tag-inheritance'"))))
(defcustom org-tags-match-list-sublevels t
"Non-nil means list also sublevels of headlines matching a search.
This variable applies to tags/property searches, and also to stuck
projects because this search is based on a tags match as well.
When set to the symbol `indented', sublevels are indented with
leading dots.
Because of tag inheritance (see variable `org-use-tag-inheritance'),
the sublevels of a headline matching a tag search often also match
the same search. Listing all of them can create very long lists.
Setting this variable to nil causes subtrees of a match to be skipped.
This variable is semi-obsolete and probably should always be true. It
is better to limit inheritance to certain tags using the variables
`org-use-tag-inheritance' and `org-tags-exclude-from-inheritance'."
:group 'org-tags
:type '(choice
(const :tag "No, don't list them" nil)
(const :tag "Yes, do list them" t)
(const :tag "List them, indented with leading dots" indented)))
(defcustom org-tags-sort-function nil
"When set, tags are sorted using this function as a comparator."
:group 'org-tags
:type '(choice
(const :tag "No sorting" nil)
(const :tag "Alphabetical" string<)
(const :tag "Reverse alphabetical" string>)
(function :tag "Custom function" nil)))
(defvar org-tags-history nil
"History of minibuffer reads for tags.")
(defvar org-last-tags-completion-table nil
"The last used completion table for tags.")
(defvar org-after-tags-change-hook nil
"Hook that is run after the tags in a line have changed.")
(defgroup org-properties nil
"Options concerning properties in Org-mode."
:tag "Org Properties"
:group 'org)
(defcustom org-property-format "%-10s %s"
"How property key/value pairs should be formatted by `indent-line'.
When `indent-line' hits a property definition, it will format the line
according to this format, mainly to make sure that the values are
lined-up with respect to each other."
:group 'org-properties
:type 'string)
(defcustom org-properties-postprocess-alist nil
"Alist of properties and functions to adjust inserted values.
Elements of this alist must be of the form
([string] [function])
where [string] must be a property name and [function] must be a
lambda expression: this lambda expression must take one argument,
the value to adjust, and return the new value as a string.
For example, this element will allow the property \"Remaining\"
to be updated wrt the relation between the \"Effort\" property
and the clock summary:
((\"Remaining\" (lambda(value)
(let ((clocksum (org-clock-sum-current-item))
(effort (org-duration-string-to-minutes
(org-entry-get (point) \"Effort\"))))
(org-minutes-to-clocksum-string (- effort clocksum))))))"
:group 'org-properties
:version "24.1"
:type '(alist :key-type (string :tag "Property")
:value-type (function :tag "Function")))
(defcustom org-use-property-inheritance nil
"Non-nil means properties apply also for sublevels.
This setting is chiefly used during property searches. Turning it on can
cause significant overhead when doing a search, which is why it is not
on by default.
When nil, only the properties directly given in the current entry count.
When t, every property is inherited. The value may also be a list of
properties that should have inheritance, or a regular expression matching
properties that should be inherited.
However, note that some special properties use inheritance under special
circumstances (not in searches). Examples are CATEGORY, ARCHIVE, COLUMNS,
and the properties ending in \"_ALL\" when they are used as descriptor
for valid values of a property.
Note for programmers:
When querying an entry with `org-entry-get', you can control if inheritance
should be used. By default, `org-entry-get' looks only at the local
properties. You can request inheritance by setting the inherit argument
to t (to force inheritance) or to `selective' (to respect the setting
in this variable)."
:group 'org-properties
:type '(choice
(const :tag "Not" nil)
(const :tag "Always" t)
(repeat :tag "Specific properties" (string :tag "Property"))
(regexp :tag "Properties matched by regexp")))
(defun org-property-inherit-p (property)
"Check if PROPERTY is one that should be inherited."
((eq org-use-property-inheritance t) t)
((not org-use-property-inheritance) nil)
((stringp org-use-property-inheritance)
(string-match org-use-property-inheritance property))
((listp org-use-property-inheritance)
(member property org-use-property-inheritance))
(t (error "Invalid setting of `org-use-property-inheritance'"))))
(defcustom org-columns-default-format "%25ITEM %TODO %3PRIORITY %TAGS"
"The default column format, if no other format has been defined.
This variable can be set on the per-file basis by inserting a line
#+COLUMNS: %25ITEM ....."
:group 'org-properties
:type 'string)
(defcustom org-columns-ellipses ".."
"The ellipses to be used when a field in column view is truncated.
When this is the empty string, as many characters as possible are shown,
but then there will be no visual indication that the field has been truncated.
When this is a string of length N, the last N characters of a truncated
field are replaced by this string. If the column is narrower than the
ellipses string, only part of the ellipses string will be shown."
:group 'org-properties
:type 'string)
(defcustom org-columns-modify-value-for-display-function nil
"Function that modifies values for display in column view.
For example, it can be used to cut out a certain part from a time stamp.
The function must take 2 arguments:
column-title The title of the column (*not* the property name)
value The value that should be modified.
The function should return the value that should be displayed,
or nil if the normal value should be used."
:group 'org-properties
:type '(choice (const nil) (function)))
(defcustom org-effort-property "Effort"
"The property that is being used to keep track of effort estimates.
Effort estimates given in this property need to have the format H:MM."
:group 'org-properties
:group 'org-progress
:type '(string :tag "Property"))
(defconst org-global-properties-fixed
'(("VISIBILITY_ALL" . "folded children content all")
("CLOCK_MODELINE_TOTAL_ALL" . "current today repeat all auto"))
"List of property/value pairs that can be inherited by any entry.
These are fixed values, for the preset properties. The user variable
that can be used to add to this list is `org-global-properties'.
The entries in this list are cons cells where the car is a property
name and cdr is a string with the value. If the value represents
multiple items like an \"_ALL\" property, separate the items by
(defcustom org-global-properties nil
"List of property/value pairs that can be inherited by any entry.
This list will be combined with the constant `org-global-properties-fixed'.
The entries in this list are cons cells where the car is a property
name and cdr is a string with the value.
You can set buffer-local values for the same purpose in the variable
`org-file-properties' this by adding lines like
:group 'org-properties
:type '(repeat
(cons (string :tag "Property")
(string :tag "Value"))))
(defvar org-file-properties nil
"List of property/value pairs that can be inherited by any entry.
Valid for the current buffer.
This variable is populated from #+PROPERTY lines.")
(make-variable-buffer-local 'org-file-properties)
(defgroup org-agenda nil
"Options concerning agenda views in Org-mode."
:tag "Org Agenda"
:group 'org)
(defvar org-category nil
"Variable used by org files to set a category for agenda display.
Such files should use a file variable to set it, for example
# -*- mode: org; org-category: \"ELisp\"
or contain a special line
If the file does not specify a category, then file's base name
is used instead.")
(make-variable-buffer-local 'org-category)
(put 'org-category 'safe-local-variable #'(lambda (x) (or (symbolp x) (stringp x))))
(defcustom org-agenda-files nil
"The files to be used for agenda display.
Entries may be added to this list with \\[org-agenda-file-to-front] and removed with
\\[org-remove-file]. You can also use customize to edit the list.
If an entry is a directory, all files in that directory that are matched by
`org-agenda-file-regexp' will be part of the file list.
If the value of the variable is not a list but a single file name, then
the list of agenda files is actually stored and maintained in that file, one
agenda file per line. In this file paths can be given relative to
`org-directory'. Tilde expansion and environment variable substitution
are also made."
:group 'org-agenda
:type '(choice
(repeat :tag "List of files and directories" file)
(file :tag "Store list in a file\n" :value "~/.agenda_files")))
(defcustom org-agenda-file-regexp "\\`[^.].*\\.org\\'"
"Regular expression to match files for `org-agenda-files'.
If any element in the list in that variable contains a directory instead
of a normal file, all files in that directory that are matched by this
regular expression will be included."
:group 'org-agenda
:type 'regexp)
(defcustom org-agenda-text-search-extra-files nil
"List of extra files to be searched by text search commands.
These files will be searched in addition to the agenda files by the
commands `org-search-view' (`C-c a s') and `org-occur-in-agenda-files'.
Note that these files will only be searched for text search commands,
not for the other agenda views like todo lists, tag searches or the weekly
agenda. This variable is intended to list notes and possibly archive files
that should also be searched by these two commands.
In fact, if the first element in the list is the symbol `agenda-archives',
then all archive files of all agenda files will be added to the search
:group 'org-agenda
:type '(set :greedy t
(const :tag "Agenda Archives" agenda-archives)
(repeat :inline t (file))))
(org-defvaralias 'org-agenda-multi-occur-extra-files
(defcustom org-agenda-skip-unavailable-files nil
"Non-nil means to just skip non-reachable files in `org-agenda-files'.
A nil value means to remove them, after a query, from the list."
:group 'org-agenda
:type 'boolean)
(defcustom org-calendar-to-agenda-key [?c]
"The key to be installed in `calendar-mode-map' for switching to the agenda.
The command `org-calendar-goto-agenda' will be bound to this key. The
default is the character `c' because then `c' can be used to switch back and
forth between agenda and calendar."
:group 'org-agenda
:type 'sexp)
(defcustom org-calendar-insert-diary-entry-key [?i]
"The key to be installed in `calendar-mode-map' for adding diary entries.
This option is irrelevant until `org-agenda-diary-file' has been configured
to point to an Org-mode file. When that is the case, the command
`org-agenda-diary-entry' will be bound to the key given here, by default
`i'. In the calendar, `i' normally adds entries to `diary-file'. So
if you want to continue doing this, you need to change this to a different
:group 'org-agenda
:type 'sexp)
(defcustom org-agenda-diary-file 'diary-file
"File to which to add new entries with the `i' key in agenda and calendar.
When this is the symbol `diary-file', the functionality in the Emacs
calendar will be used to add entries to the `diary-file'. But when this
points to a file, `org-agenda-diary-entry' will be used instead."
:group 'org-agenda
:type '(choice
(const :tag "The standard Emacs diary file" diary-file)
(file :tag "Special Org file diary entries")))
(eval-after-load "calendar"
(org-defkey calendar-mode-map org-calendar-to-agenda-key
(add-hook 'calendar-mode-hook
(lambda ()
(unless (eq org-agenda-diary-file 'diary-file)
(define-key calendar-mode-map
(defgroup org-latex nil
"Options for embedding LaTeX code into Org-mode."
:tag "Org LaTeX"
:group 'org)
(defcustom org-format-latex-options
'(:foreground default :background default :scale 1.0
:html-foreground "Black" :html-background "Transparent"
:html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))
"Options for creating images from LaTeX fragments.
This is a property list with the following properties:
:foreground the foreground color for images embedded in Emacs, e.g. \"Black\".
`default' means use the foreground of the default face.
`auto' means use the foreground from the text face.
:background the background color, or \"Transparent\".
`default' means use the background of the default face.
`auto' means use the background from the text face.
:scale a scaling factor for the size of the images, to get more pixels
:html-foreground, :html-background, :html-scale
the same numbers for HTML export.
:matchers a list indicating which matchers should be used to
find LaTeX fragments. Valid members of this list are:
\"begin\" find environments
\"$1\" find single characters surrounded by $.$
\"$\" find math expressions surrounded by $...$
\"$$\" find math expressions surrounded by $$....$$
\"\\(\" find math expressions surrounded by \\(...\\)
\"\\=\\[\" find math expressions surrounded by \\=\\[...\\]"
:group 'org-latex
:type 'plist)
(defcustom org-format-latex-signal-error t
"Non-nil means signal an error when image creation of LaTeX snippets fails.
When nil, just push out a message."
:group 'org-latex
:version "24.1"
:type 'boolean)
(defcustom org-latex-to-mathml-jar-file nil
"Value of\"%j\" in `org-latex-to-mathml-convert-command'.
Use this to specify additional executable file say a jar file.
When using MathToWeb as the converter, specify the full-path to
your mathtoweb.jar file."
:group 'org-latex
:version "24.1"
:type '(choice
(const :tag "None" nil)
(file :tag "JAR file" :must-match t)))
(defcustom org-latex-to-mathml-convert-command nil
"Command to convert LaTeX fragments to MathML.
Replace format-specifiers in the command as noted below and use
`shell-command' to convert LaTeX to MathML.
%j: Executable file in fully expanded form as specified by
%I: Input LaTeX file in fully expanded form
%o: Output MathML file
This command is used by `org-create-math-formula'.
When using MathToWeb as the converter, set this to
\"java -jar %j -unicode -force -df %o %I\"."
:group 'org-latex
:version "24.1"
:type '(choice
(const :tag "None" nil)
(string :tag "\nShell command")))
(defcustom org-latex-create-formula-image-program 'dvipng
"Program to convert LaTeX fragments with.
dvipng Process the LaTeX fragments to dvi file, then convert
dvi files to png files using dvipng.
This will also include processing of non-math environments.
imagemagick Convert the LaTeX fragments to pdf files and use imagemagick
to convert pdf files to png files"
:group 'org-latex
:version "24.1"
:type '(choice
(const :tag "dvipng" dvipng)
(const :tag "imagemagick" imagemagick)))
(defcustom org-latex-preview-ltxpng-directory "ltxpng/"
"Path to store latex preview images.
A relative path here creates many directories relative to the
processed org files paths. An absolute path puts all preview
images at the same place."
:group 'org-latex
:version "24.3"
:type 'string)
(defun org-format-latex-mathml-available-p ()
"Return t if `org-latex-to-mathml-convert-command' is usable."
(when (and (boundp 'org-latex-to-mathml-convert-command)
(let ((executable (car (split-string
(when (executable-find executable)
(if (string-match
"%j" org-latex-to-mathml-convert-command)
(file-readable-p org-latex-to-mathml-jar-file)
(defcustom org-format-latex-header "\\documentclass{article}
\\pagestyle{empty} % do not remove
% The settings below are copied from fullpage.sty
"The document header used for processing LaTeX fragments.
It is imperative that this header make sure that no page number
appears on the page. The package defined in the variables
`org-latex-default-packages-alist' and `org-latex-packages-alist'
will either replace the placeholder \"[PACKAGES]\" in this
header, or they will be appended."
:group 'org-latex
:type 'string)
(defun org-set-packages-alist (var val)
"Set the packages alist and make sure it has 3 elements per entry."
(set var (mapcar (lambda (x)
(if (and (consp x) (= (length x) 2))
(list (car x) (nth 1 x) t)
(defun org-get-packages-alist (var)
"Get the packages alist and make sure it has 3 elements per entry."
(mapcar (lambda (x)
(if (and (consp x) (= (length x) 2))
(list (car x) (nth 1 x) t)
(default-value var)))
(defcustom org-latex-default-packages-alist
'(("AUTO" "inputenc" t)
("T1" "fontenc" t)
("" "fixltx2e" nil)
("" "graphicx" t)
("" "longtable" nil)
("" "float" nil)
("" "wrapfig" nil)
("" "rotating" nil)
("normalem" "ulem" t)
("" "amsmath" t)
("" "textcomp" t)
("" "marvosym" t)
("" "wasysym" t)
("" "amssymb" t)
("" "hyperref" nil)
"Alist of default packages to be inserted in the header.
Change this only if one of the packages here causes an
incompatibility with another package you are using.
The packages in this list are needed by one part or another of
Org mode to function properly:
- inputenc, fontenc: for basic font and character selection
- fixltx2e: Important patches of LaTeX itself
- graphicx: for including images
- longtable: For multipage tables
- float, wrapfig: for figure placement
- rotating: for sideways figures and tables
- ulem: for underline and strike-through
- amsmath: for subscript and superscript and math environments
- textcomp, marvosymb, wasysym, amssymb: for various symbols used
for interpreting the entities in `org-entities'. You can skip
some of these packages if you don't use any of their symbols.
- hyperref: for cross references
Therefore you should not modify this variable unless you know
what you are doing. The one reason to change it anyway is that
you might be loading some other package that conflicts with one
of the default packages. Each element is either a cell or
a string.
A cell is of the format:
\( \"options\" \"package\" SNIPPET-FLAG).
If SNIPPET-FLAG is non-nil, the package also needs to be included
when compiling LaTeX snippets into images for inclusion into
non-LaTeX output.
A string will be inserted as-is in the header of the document."
:group 'org-latex
:group 'org-export-latex
:set 'org-set-packages-alist
:get 'org-get-packages-alist
:version "24.1"
:type '(repeat
(list :tag "options/package pair"
(string :tag "options")
(string :tag "package")
(boolean :tag "Snippet"))
(string :tag "A line of LaTeX"))))
(defcustom org-latex-packages-alist nil
"Alist of packages to be inserted in every LaTeX header.
These will be inserted after `org-latex-default-packages-alist'.
Each element is either a cell or a string.
A cell is of the format:
\(\"options\" \"package\" SNIPPET-FLAG)
SNIPPET-FLAG, when non-nil, indicates that this package is also
needed when turning LaTeX snippets into images for inclusion into
non-LaTeX output.
A string will be inserted as-is in the header of the document.
Make sure that you only list packages here which:
- you want in every file;
- do not conflict with the setup in `org-format-latex-header';
- do not conflict with the default packages in
:group 'org-latex
:group 'org-export-latex
:set 'org-set-packages-alist
:get 'org-get-packages-alist
:type '(repeat
(list :tag "options/package pair"
(string :tag "options")
(string :tag "package")
(boolean :tag "Snippet"))
(string :tag "A line of LaTeX"))))
(defgroup org-appearance nil
"Settings for Org-mode appearance."
:tag "Org Appearance"
:group 'org)
(defcustom org-level-color-stars-only nil
"Non-nil means fontify only the stars in each headline.
When nil, the entire headline is fontified.
Changing it requires restart of `font-lock-mode' to become effective
also in regions already fontified."
:group 'org-appearance
:type 'boolean)
(defcustom org-hide-leading-stars nil
"Non-nil means hide the first N-1 stars in a headline.
This works by using the face `org-hide' for these stars. This
face is white for a light background, and black for a dark
background. You may have to customize the face `org-hide' to
make this work.
Changing it requires restart of `font-lock-mode' to become effective
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: hidestars
#+STARTUP: showstars"
:group 'org-appearance
:type 'boolean)
(defcustom org-hidden-keywords nil
"List of symbols corresponding to keywords to be hidden the org buffer.
For example, a value '(title) for this list will make the document's title
appear in the buffer without the initial #+TITLE: keyword."
:group 'org-appearance
:version "24.1"
:type '(set (const :tag "#+AUTHOR" author)
(const :tag "#+DATE" date)
(const :tag "#+EMAIL" email)
(const :tag "#+TITLE" title)))
(defcustom org-custom-properties nil
"List of properties (as strings) with a special meaning.
The default use of these custom properties is to let the user
hide them with `org-toggle-custom-properties-visibility'."
:group 'org-properties
:group 'org-appearance
:version "24.3"
:type '(repeat (string :tag "Property Name")))
(defcustom org-fontify-done-headline nil
"Non-nil means change the face of a headline if it is marked DONE.
Normally, only the TODO/DONE keyword indicates the state of a headline.
When this is non-nil, the headline after the keyword is set to the
`org-headline-done' as an additional indication."
:group 'org-appearance
:type 'boolean)
(defcustom org-fontify-emphasized-text t
"Non-nil means fontify *bold*, /italic/ and _underlined_ text.
Changing this variable requires a restart of Emacs to take effect."
:group 'org-appearance
:type 'boolean)
(defcustom org-fontify-whole-heading-line nil
"Non-nil means fontify the whole line for headings.
This is useful when setting a background color for the
org-level-* faces."
:group 'org-appearance
:type 'boolean)
(defcustom org-highlight-latex-and-related nil
"Non-nil means highlight LaTeX related syntax in the buffer.
When non nil, the value should be a list containing any of the
following symbols:
`latex' Highlight LaTeX snippets and environments.
`script' Highlight subscript and superscript.
`entities' Highlight entities."
:group 'org-appearance
:version "24.4"
:package-version '(Org . "8.0")
:type '(choice
(const :tag "No highlighting" nil)
(set :greedy t :tag "Highlight"
(const :tag "LaTeX snippets and environments" latex)
(const :tag "Subscript and superscript" script)
(const :tag "Entities" entities))))
(defcustom org-hide-emphasis-markers nil
"Non-nil mean font-lock should hide the emphasis marker characters."
:group 'org-appearance
:type 'boolean)
(defcustom org-pretty-entities nil
"Non-nil means show entities as UTF8 characters.
When nil, the \\name form remains in the buffer."
:group 'org-appearance
:version "24.1"
:type 'boolean)
(defcustom org-pretty-entities-include-sub-superscripts t
"Non-nil means, pretty entity display includes formatting sub/superscripts."
:group 'org-appearance
:version "24.1"
:type 'boolean)
(defvar org-emph-re nil
"Regular expression for matching emphasis.
After a match, the match groups contain these elements:
0 The match of the full regular expression, including the characters
before and after the proper match
1 The character before the proper match, or empty at beginning of line
2 The proper match, including the leading and trailing markers
3 The leading marker like * or /, indicating the type of highlighting
4 The text between the emphasis markers, not including the markers
5 The character after the match, empty at the end of a line")
(defvar org-verbatim-re nil
"Regular expression for matching verbatim text.")
(defvar org-emphasis-regexp-components) ; defined just below
(defvar org-emphasis-alist) ; defined just below
(defun org-set-emph-re (var val)
"Set variable and compute the emphasis regular expression."
(set var val)
(when (and (boundp 'org-emphasis-alist)
(boundp 'org-emphasis-regexp-components)
org-emphasis-alist org-emphasis-regexp-components)
(let* ((e org-emphasis-regexp-components)
(pre (car e))
(post (nth 1 e))
(border (nth 2 e))
(body (nth 3 e))
(nl (nth 4 e))
(body1 (concat body "*?"))
(markers (mapconcat 'car org-emphasis-alist ""))
(vmarkers (mapconcat
(lambda (x) (if (eq (nth 2 x) 'verbatim) (car x) ""))
org-emphasis-alist "")))
;; make sure special characters appear at the right position in the class
(if (string-match "\\^" markers)
(setq markers (concat (replace-match "" t t markers) "^")))
(if (string-match "-" markers)
(setq markers (concat (replace-match "" t t markers) "-")))
(if (string-match "\\^" vmarkers)
(setq vmarkers (concat (replace-match "" t t vmarkers) "^")))
(if (string-match "-" vmarkers)
(setq vmarkers (concat (replace-match "" t t vmarkers) "-")))
(if (> nl 0)
(setq body1 (concat body1 "\\(?:\n" body "*?\\)\\{0,"
(int-to-string nl) "\\}")))
;; Make the regexp
(setq org-emph-re
(concat "\\([" pre "]\\|^\\)"
"\\([" markers "]\\)"
"[^" border "]\\|"
"[^" border "]"
"[^" border "]"
"\\([" post "]\\|$\\)"))
(setq org-verbatim-re
(concat "\\([" pre "]\\|^\\)"
"\\([" vmarkers "]\\)"
"[^" border "]\\|"
"[^" border "]"
"[^" border "]"
"\\([" post "]\\|$\\)")))))
;; This used to be a defcustom (Org <8.0) but allowing the users to
;; set this option proved cumbersome. See this message/thread:
(defvar org-emphasis-regexp-components
'(" \t('\"{" "- \t.,:!?;'\")}\\" " \t\r\n,\"'" "." 1)
"Components used to build the regular expression for emphasis.
This is a list with five entries. Terminology: In an emphasis string
like \" *strong word* \", we call the initial space PREMATCH, the final
space POSTMATCH, the stars MARKERS, \"s\" and \"d\" are BORDER characters
and \"trong wor\" is the body. The different components in this variable
specify what is allowed/forbidden in each part:
pre Chars allowed as prematch. Beginning of line will be allowed too.
post Chars allowed as postmatch. End of line will be allowed too.
border The chars *forbidden* as border characters.
body-regexp A regexp like \".\" to match a body character. Don't use
non-shy groups here, and don't allow newline here.
newline The maximum number of newlines allowed in an emphasis exp.
You need to reload Org or to restart Emacs after customizing this.")
(defcustom org-emphasis-alist
`(("*" bold)
("/" italic)
("_" underline)
("=" org-verbatim verbatim)
("~" org-code verbatim)
("+" ,(if (featurep 'xemacs) 'org-table '(:strike-through t))))
"Alist of characters and faces to emphasize text.
Text starting and ending with a special character will be emphasized,
for example *bold*, _underlined_ and /italic/. This variable sets the
marker characters and the face to be used by font-lock for highlighting
in Org-mode Emacs buffers.
You need to reload Org or to restart Emacs after customizing this."
:group 'org-appearance
:set 'org-set-emph-re
:version "24.4"
:package-version '(Org . "8.0")
:type '(repeat
(string :tag "Marker character")
(face :tag "Font-lock-face")
(plist :tag "Face property list"))
(option (const verbatim)))))
(defvar org-protecting-blocks
'("src" "example" "latex" "ascii" "html" "ditaa" "dot" "r" "R")
"Blocks that contain text that is quoted, i.e. not processed as Org syntax.
This is needed for font-lock setup.")
;;; Miscellaneous options
(defgroup org-completion nil
"Completion in Org-mode."
:tag "Org Completion"
:group 'org)
(defcustom org-completion-use-ido nil
"Non-nil means use ido completion wherever possible.
Note that `ido-mode' must be active for this variable to be relevant.
If you decide to turn this variable on, you might well want to turn off
See also `org-completion-use-iswitchb'."
:group 'org-completion
:type 'boolean)
(defcustom org-completion-use-iswitchb nil
"Non-nil means use iswitchb completion wherever possible.
Note that `iswitchb-mode' must be active for this variable to be relevant.
If you decide to turn this variable on, you might well want to turn off
Note that this variable has only an effect if `org-completion-use-ido' is nil."
:group 'org-completion
:type 'boolean)
(defcustom org-completion-fallback-command 'hippie-expand
"The expansion command called by \\[pcomplete] in normal context.
Normal means, no org-mode-specific context."
:group 'org-completion
:type 'function)
;;; Functions and variables from their packages
;; Declared here to avoid compiler warnings
;; XEmacs only
(defvar outline-mode-menu-heading)
(defvar outline-mode-menu-show)
(defvar outline-mode-menu-hide)
(defvar zmacs-regions) ; XEmacs regions
;; Emacs only
(defvar mark-active)
;; Various packages
(declare-function calendar-absolute-from-iso "cal-iso" (date))
(declare-function calendar-forward-day "cal-move" (arg))
(declare-function calendar-goto-date "cal-move" (date))
(declare-function calendar-goto-today "cal-move" ())
(declare-function calendar-iso-from-absolute "cal-iso" (date))
(defvar calc-embedded-close-formula)
(defvar calc-embedded-open-formula)
(declare-function cdlatex-tab "ext:cdlatex" ())
(declare-function cdlatex-compute-tables "ext:cdlatex" ())
(declare-function dired-get-filename "dired" (&optional localp no-error-if-not-filep))
(defvar font-lock-unfontify-region-function)
(declare-function iswitchb-read-buffer "iswitchb"
(prompt &optional default require-match start matches-set))
(defvar iswitchb-temp-buflist)
(declare-function org-gnus-follow-link "org-gnus" (&optional group article))
(defvar org-agenda-tags-todo-honor-ignore-options)
(declare-function org-agenda-skip "org-agenda" ())
org-agenda-format-item "org-agenda"
(extra txt &optional level category tags dotime noprefix remove-re habitp))
(declare-function org-agenda-new-marker "org-agenda" (&optional pos))
(declare-function org-agenda-change-all-lines "org-agenda"
(newhead hdmarker &optional fixface just-this))
(declare-function org-agenda-set-restriction-lock "org-agenda" (&optional type))
(declare-function org-agenda-maybe-redo "org-agenda" ())
(declare-function org-agenda-save-markers-for-cut-and-paste "org-agenda"
(beg end))
(declare-function org-agenda-copy-local-variable "org-agenda" (var))
(declare-function org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item
"org-agenda" (&optional end))
(declare-function org-inlinetask-remove-END-maybe "org-inlinetask" ())
(declare-function org-inlinetask-in-task-p "org-inlinetask" ())
(declare-function org-inlinetask-goto-beginning "org-inlinetask" ())
(declare-function org-inlinetask-goto-end "org-inlinetask" ())
(declare-function org-indent-mode "org-indent" (&optional arg))
(declare-function parse-time-string "parse-time" (string))
(declare-function org-attach-reveal "org-attach" (&optional if-exists))
(declare-function orgtbl-send-table "org-table" (&optional maybe))
(defvar remember-data-file)
(defvar texmathp-why)
(declare-function speedbar-line-directory "speedbar" (&optional depth))
(declare-function table--at-cell-p "table" (position &optional object at-column))
(defvar org-latex-regexps)
;;; Autoload and prepare some org modules
;; Some table stuff that needs to be defined here, because it is used
;; by the functions setting up org-mode or checking for table context.
(defconst org-table-any-line-regexp "^[ \t]*\\(|\\|\\+-[-+]\\)"
"Detect an org-type or table-type table.")
(defconst org-table-line-regexp "^[ \t]*|"
"Detect an org-type table line.")
(defconst org-table-dataline-regexp "^[ \t]*|[^-]"
"Detect an org-type table line.")
(defconst org-table-hline-regexp "^[ \t]*|-"
"Detect an org-type table hline.")
(defconst org-table1-hline-regexp "^[ \t]*\\+-[-+]"
"Detect a table-type table hline.")
(defconst org-table-any-border-regexp "^[ \t]*[^|+ \t]"
"Detect the first line outside a table when searching from within it.
This works for both table types.")
(defconst org-TBLFM-regexp "^[ \t]*#\\+TBLFM: "
"Detect a #+TBLFM line.")
(defun turn-on-orgtbl ()
"Unconditionally turn on `orgtbl-mode'."
(require 'org-table)
(orgtbl-mode 1))
(defun org-at-table-p (&optional table-type)
"Return t if the cursor is inside an org-type table.
If TABLE-TYPE is non-nil, also check for table.el-type tables."
(if org-enable-table-editor
(beginning-of-line 1)
(looking-at (if table-type org-table-any-line-regexp
(defsubst org-table-p () (org-at-table-p))
(defun org-at-table.el-p ()
"Return t if and only if we are at a table.el table."
(and (org-at-table-p 'any)
(goto-char (org-table-begin 'any))
(looking-at org-table1-hline-regexp))))
(defun org-table-recognize-table.el ()
"If there is a table.el table nearby, recognize it and move into it."
(if org-table-tab-recognizes-table.el
(if (org-at-table.el-p)
(beginning-of-line 1)
(if (looking-at org-table-dataline-regexp)
(if (looking-at org-table1-hline-regexp)
(beginning-of-line 2)
(if (looking-at org-table-any-border-regexp)
(beginning-of-line -1)))))
(if (re-search-forward "|" (org-table-end t) t)
(require 'table)
(if (table--at-cell-p (point))
(message "recognizing table.el table...")
(message "recognizing table.el table...done")))
(error "This should not happen"))
(defun org-at-table-hline-p ()
"Return t if the cursor is inside a hline in a table."
(if org-enable-table-editor
(beginning-of-line 1)
(looking-at org-table-hline-regexp))
(defun org-table-map-tables (function &optional quietly)
"Apply FUNCTION to the start of all tables in the buffer."
(goto-char (point-min))
(while (re-search-forward org-table-any-line-regexp nil t)
(unless quietly
(message "Mapping tables: %d%%" (/ (* 100.0 (point)) (buffer-size))))
(beginning-of-line 1)
(when (and (looking-at org-table-line-regexp)
;; Exclude tables in src/example/verbatim/clocktable blocks
(not (org-in-block-p '("src" "example" "verbatim" "clocktable"))))
(save-excursion (funcall function))
(or (looking-at org-table-line-regexp)
(forward-char 1)))
(re-search-forward org-table-any-border-regexp nil 1))))
(unless quietly (message "Mapping tables: done")))
(declare-function org-clock-save-markers-for-cut-and-paste "org-clock" (beg end))
(declare-function org-clock-update-mode-line "org-clock" ())
(declare-function org-resolve-clocks "org-clock"
(&optional also-non-dangling-p prompt last-valid))
(defun org-at-TBLFM-p (&optional pos)
"Return t when point (or POS) is in #+TBLFM line."
(let ((pos pos)))
(goto-char (or pos (point)))
(beginning-of-line 1)
(looking-at org-TBLFM-regexp)))
(defvar org-clock-start-time)
(defvar org-clock-marker (make-marker)
"Marker recording the last clock-in.")
(defvar org-clock-hd-marker (make-marker)
"Marker recording the last clock-in, but the headline position.")
(defvar org-clock-heading ""
"The heading of the current clock entry.")
(defun org-clock-is-active ()
"Return the buffer where the clock is currently running.
Return nil if no clock is running."
(marker-buffer org-clock-marker))
(defun org-check-running-clock ()
"Check if the current buffer contains the running clock.
If yes, offer to stop it and to save the buffer with the changes."
(when (and (equal (marker-buffer org-clock-marker) (current-buffer))
(y-or-n-p (format "Clock-out in buffer %s before killing it? "
(when (y-or-n-p "Save changed buffer?")
(defun org-clocktable-try-shift (dir n)
"Check if this line starts a clock table, if yes, shift the time block."
(when (org-match-line "^[ \t]*#\\+BEGIN:[ \t]+clocktable\\>")
(org-clocktable-shift dir n)))
(defun org-clock-persistence-insinuate ()
"Set up hooks for clock persistence."
(require 'org-clock)
(add-hook 'org-mode-hook 'org-clock-load)
(add-hook 'kill-emacs-hook 'org-clock-save))
(defgroup org-archive nil
"Options concerning archiving in Org-mode."
:tag "Org Archive"
:group 'org-structure)
(defcustom org-archive-location "%s_archive::"
"The location where subtrees should be archived.
The value of this variable is a string, consisting of two parts,
separated by a double-colon. The first part is a filename and
the second part is a headline.
When the filename is omitted, archiving happens in the same file.
%s in the filename will be replaced by the current file
name (without the directory part). Archiving to a different file
is useful to keep archived entries from contributing to the
Org-mode Agenda.
The archived entries will be filed as subtrees of the specified
headline. When the headline is omitted, the subtrees are simply
filed away at the end of the file, as top-level entries. Also in
the heading you can use %s to represent the file name, this can be
useful when using the same archive for a number of different files.
Here are a few examples:
If the current file is, archive in file
Projects.org_archive, as top-level trees. This is the default.
\"::* Archived Tasks\"
Archive in the current file, under the top-level headline
\"* Archived Tasks\".
Archive in file ~/org/ (absolute path), as top-level trees.
\"~/org/* From %s\"
Archive in file ~/org/ (absolute path), under headlines
\"From FILENAME\" where file name is the current file name.
\"~/org/* Finished Tasks\"
The \"datetree/\" string is special, signifying to archive
items to the datetree. Items are placed in either the CLOSED
date of the item, or the current date if there is no CLOSED date.
The heading will be a subentry to the current date. There doesn't
need to be a heading, but there always needs to be a slash after
datetree. For example, to store archived items directly in the
datetree, use \"~/org/\".
\"basement::** Finished Tasks\"
Archive in file ./basement (relative path), as level 3 trees
below the level 2 heading \"** Finished Tasks\".
You may set this option on a per-file basis by adding to the buffer a
line like
#+ARCHIVE: basement::** Finished Tasks
You may also define it locally for a subtree by setting an ARCHIVE property
in the entry. If such a property is found in an entry, or anywhere up
the hierarchy, it will be used."
:group 'org-archive
:type 'string)
(defcustom 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.
After changing this, font-lock must be restarted in the relevant buffers to
get the proper fontification."
:group 'org-archive
:group 'org-keywords
:type 'string)
(defcustom org-agenda-skip-archived-trees t
"Non-nil means the agenda will skip any items located in archived trees.
An archived tree is a tree marked with the tag ARCHIVE. The use of this
variable is no longer recommended, you should leave it at the value t.
Instead, use the key `v' to cycle the archives-mode in the agenda."
:group 'org-archive
:group 'org-agenda-skip
:type 'boolean)
(defcustom org-columns-skip-archived-trees t
"Non-nil means ignore archived trees when creating column view."
:group 'org-archive
:group 'org-properties
:type 'boolean)
(defcustom org-cycle-open-archived-trees nil
"Non-nil means `org-cycle' will open archived trees.
An archived tree is a tree marked with the tag ARCHIVE.