;;;; org.el --- Outline-based notes management and organizer ;; Carstens outline-mode for keeping track of everything. ;; Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ;; ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ ;; Version: 4.72 ;; ;; 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 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; 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 ;; ;; http://staff.science.uva.nl/~dominik/Tools/org/org.html#Installation ;; ;; Documentation ;; ------------- ;; The documentation of Org-mode can be found in the TeXInfo file. The ;; distribution also contains a PDF version of it. At the 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 ;; http://www.astro.uva.nl/~dominik/Tools/org/Changes ;; ;;; Code: ;;;; Require other packages (eval-when-compile (require 'cl) (require 'gnus-sum) (require 'calendar)) ;; For XEmacs, noutline is not yet provided by outline.el, so arrange for ;; the file noutline.el being loaded. (if (featurep 'xemacs) (condition-case nil (require 'noutline))) ;; We require noutline, which might be provided in outline.el (require 'outline) (require 'noutline) ;; Other stuff we need. (require 'time-date) (require 'easymenu) ;;;; Customization variables ;;; Version (defconst org-version "4.72" "The version number of the file org.el.") (defun org-version () (interactive) (message "Org-mode version %s" org-version)) ;;; Compatibility constants (defconst org-xemacs-p (featurep 'xemacs)) ; not used by org.el itself (defconst org-format-transports-properties-p (let ((x "a")) (add-text-properties 0 1 '(test t) x) (get-text-property 0 'test (format "%s" x))) "Does format transport text properties?") ;;; The custom variables (defgroup org nil "Outline-based notes management and organizer." :tag "Org" :group 'outlines :group 'hypermedia :group 'calendar) (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 #+STARTUP: nofold #+STARTUP: content" :group 'org-startup :type '(choice (const :tag "nofold: show all" nil) (const :tag "fold: overview" t) (const :tag "content: all headlines" content))) (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-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 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-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 S-. Org-mode used S- for changing timestamps and priorities. S- is also used for example by `CUA-mode' to select text. If you want to use Org-mode together with `CUA-mode', Org-mode needs to use alternative bindings. Setting this variable to t will replace the following keys both in Org-mode and in the Org-agenda buffer. S-up -> M-p S-down -> M-n S-left -> M-- S-right -> M-+ If you do not like the alternative keys, take a look at the variable `org-disputed-keys'. 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) (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." (let* ((nkey (key-description key)) (x (find-if (lambda (x) (equal (key-description (car x)) nkey)) org-disputed-keys))) (cond ((not x) key) (org-replace-disputed-keys (cdr x)) (t (car x))))) (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 instead, and just in Org-mode (which will then use its own display table). Changing this requires executing `M-x org-mode' in a buffer to become effective." :group 'org-startup :type '(choice (const :tag "Default" nil) (string :tag "String" :value "...#"))) (defvar org-display-table nil "The display table for org-mode, in case `org-ellipsis' is non-nil.") (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-comment-string "COMMENT" "Entries starting with this keyword will never be exported. An entry can be toggled between COMMENT and normal with \\[org-toggle-comment]. 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 \\[org-toggle-fixed-width-section]." :group 'org-keywords :type 'string) (defvar org-repeat-re "\\