aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Dominik2006-04-20 11:44:52 +0000
committerCarsten Dominik2006-04-20 11:44:52 +0000
commitd943b3c6edcae28def3a1f0036670d5989302885 (patch)
treeedc835076f567754c98d6875eabed6b9db31724f
parent570fab6c29b4b9e1cb6396d29c7070f29548fb52 (diff)
downloademacs-d943b3c6edcae28def3a1f0036670d5989302885.tar.gz
emacs-d943b3c6edcae28def3a1f0036670d5989302885.zip
* org.el (org-deadline-announce): Face removed.
(org-level-faces, org-n-levels): Converted to constant. (org-compatible-face): New function. (org-hide, org-level-1, org-level-2, org-level-3, org-level-4) (org-level-5, org-level-6, org-level-7, org-level-8) (org-special-keyword, org-warning, org-headline-done, org-link) (org-date, org-tag, org-todo, org-done, org-table, org-formula) (org-scheduled-today, org-scheduled-previously, org-time-grid): Face definition revised for better color tty support. (org-bold-re, org-italic-re, org-underline-re): New constants. (org-set-font-lock-defaults): Use the new constants. (org-agenda-highlight-todo): New function. (org-agenda-todo): Fixed bug with point at end of line. (org-agenda-change-all-lines, org-finalize-agenda-entries): Fontify TODO keywords. (org-insert-link): Preserve relative path in ../ links. (org-export-as-html): Convert links pointing to .org files into links that will work beteen the exported HTML files. (org-todo-list): Fix bug when arg=0. (org-insert-heading): More fine-tuning.
-rw-r--r--lisp/textmodes/org.el449
1 files changed, 290 insertions, 159 deletions
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index 936f8619fa2..bbb2db5fd11 100644
--- a/lisp/textmodes/org.el
+++ b/lisp/textmodes/org.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <dominik at science dot uva dot nl> 5;; Author: Carsten Dominik <dominik at science dot uva dot nl>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ 7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
8;; Version: 4.24 8;; Version: 4.25
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -81,6 +81,12 @@
81;; 81;;
82;; Changes since version 4.00: 82;; Changes since version 4.00:
83;; --------------------------- 83;; ---------------------------
84;; Version 4.25
85;; - Revision of the font-lock faces section, with better tty support.
86;; - TODO keywords in Agenda buffer are fontified.
87;; - Export converts links between .org files to links between .html files.
88;; - Better support for bold/italic/underline emphasis.
89;;
84;; Version 4.24 90;; Version 4.24
85;; - Bug fixes. 91;; - Bug fixes.
86;; 92;;
@@ -182,7 +188,7 @@
182 188
183;;; Customization variables 189;;; Customization variables
184 190
185(defvar org-version "4.24" 191(defvar org-version "4.25"
186 "The version number of the file org.el.") 192 "The version number of the file org.el.")
187(defun org-version () 193(defun org-version ()
188 (interactive) 194 (interactive)
@@ -192,7 +198,7 @@
192;; of outline.el. 198;; of outline.el.
193(defconst org-noutline-p (featurep 'noutline) 199(defconst org-noutline-p (featurep 'noutline)
194 "Are we using the new outline mode?") 200 "Are we using the new outline mode?")
195(defconst org-xemacs-p (featurep 'xemacs)) 201(defconst org-xemacs-p (featurep 'xemacs)) ;; FIXME: used by external code?
196(defconst org-format-transports-properties-p 202(defconst org-format-transports-properties-p
197 (let ((x "a")) 203 (let ((x "a"))
198 (add-text-properties 0 1 '(test t) x) 204 (add-text-properties 0 1 '(test t) x)
@@ -1829,6 +1835,18 @@ you can \"misuse\" it to add arbitrary text to the header."
1829 :group 'org-export-html 1835 :group 'org-export-html
1830 :type 'string) 1836 :type 'string)
1831 1837
1838(defcustom org-export-html-link-org-files-as-html t
1839 "Non-nil means, make file links to `file.org' point to `file.html'.
1840When org-mode is exporting an org-mode file to HTML, links to
1841non-html files are directly put into a href tag in HTML.
1842However, links to other Org-mode files (recognized by the
1843extension `.org.) should become links to the corresponding html
1844file, assuming that the linked org-mode file will also be
1845converted to HTML.
1846When nil, the links still point to the plain `.org' file."
1847 :group 'org-export-html
1848 :type 'boolean)
1849
1832(defcustom org-export-html-inline-images t 1850(defcustom org-export-html-inline-images t
1833 "Non-nil means, inline images into exported HTML pages. 1851 "Non-nil means, inline images into exported HTML pages.
1834The link will still be to the original location of the image file. 1852The link will still be to the original location of the image file.
@@ -1942,205 +1960,246 @@ Changing this variable requires a restart of Emacs to take effect."
1942 :tag "Org Faces" 1960 :tag "Org Faces"
1943 :group 'org-font-lock) 1961 :group 'org-font-lock)
1944 1962
1963(defun org-compatible-face (specs)
1964 "Make a compatible face specification.
1965XEmacs and Emacs 21 do not know about the `min-colors' attribute.
1966For them we convert a (min-colors 8) entry to a `tty' entry and move it
1967to the top of the list. The `min-colors' attribute will be removed from
1968any other entries, and any resulting duplicates will be removed entirely."
1969 (if (or (featurep 'xemacs) (< emacs-major-version 22))
1970 (let (r e a)
1971 (while (setq e (pop specs))
1972 (cond
1973 ((memq (car e) '(t default)) (push e r))
1974 ((setq a (member '(min-colors 8) (car e)))
1975 (nconc r (list (cons (cons '(type tty) (delq (car a) (car e)))
1976 (cdr e)))))
1977 ((setq a (assq 'min-colors (car e)))
1978 (setq e (cons (delq a (car e)) (cdr e)))
1979 (or (assoc (car e) r) (push e r)))
1980 (t (or (assoc (car e) r) (push e r)))))
1981 (nreverse r))
1982 specs))
1983
1945(defface org-hide 1984(defface org-hide
1946 '( 1985 '((((background light)) (:foreground "white"))
1947 (((type tty) (class color)) (:foreground "white")) 1986 (((background dark)) (:foreground "black")))
1948 (((class color) (background light)) (:foreground "white")) 1987 "Face used to hide leading stars in headlines.
1949 (((class color) (background dark)) (:foreground "black")) 1988The forground color of this face should be equal to the background
1950 (t (:inverse-video nil))) 1989color of the frame."
1951 "Face used for level 1 headlines."
1952 :group 'org-faces) 1990 :group 'org-faces)
1953 1991
1954(defface org-level-1 ;; font-lock-function-name-face 1992(defface org-level-1 ;; font-lock-function-name-face
1955 '((((type tty) (class color)) (:foreground "blue" :weight bold)) 1993 (org-compatible-face
1956 (((class color) (background light)) (:foreground "Blue")) 1994 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
1957 (((class color) (background dark)) (:foreground "LightSkyBlue")) 1995 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
1958 (t (:inverse-video t :bold t))) 1996 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
1997 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
1998 (((class color) (min-colors 8)) (:foreground "blue" :bold t))
1999 (t (:bold t))))
1959 "Face used for level 1 headlines." 2000 "Face used for level 1 headlines."
1960 :group 'org-faces) 2001 :group 'org-faces)
1961 2002
1962(defface org-level-2 ;; font-lock-variable-name-face 2003(defface org-level-2 ;; font-lock-variable-name-face
1963 '((((type tty) (class color)) (:foreground "yellow" :weight light)) 2004 (org-compatible-face
1964 (((class color) (background light)) (:foreground "DarkGoldenrod")) 2005 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
1965 (((class color) (background dark)) (:foreground "LightGoldenrod")) 2006 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
1966 (t (:bold t :italic t))) 2007 (((class color) (min-colors 8) (background light)) (:foreground "yellow"))
2008 (((class color) (min-colors 8) (background dark)) (:foreground "yellow" :bold t))
2009 (t (:bold t))))
1967 "Face used for level 2 headlines." 2010 "Face used for level 2 headlines."
1968 :group 'org-faces) 2011 :group 'org-faces)
1969 2012
1970(defface org-level-3 ;; font-lock-keyword-face 2013(defface org-level-3 ;; font-lock-keyword-face
1971 '((((type tty) (class color)) (:foreground "cyan" :weight bold)) 2014 (org-compatible-face
1972 (((class color) (background light)) (:foreground "Purple")) 2015 '((((class color) (min-colors 88) (background light)) (:foreground "Purple"))
1973 (((class color) (background dark)) (:foreground "Cyan")) 2016 (((class color) (min-colors 88) (background dark)) (:foreground "Cyan1"))
1974 (t (:bold t))) 2017 (((class color) (min-colors 16) (background light)) (:foreground "Purple"))
2018 (((class color) (min-colors 16) (background dark)) (:foreground "Cyan"))
2019 (((class color) (min-colors 8) (background light)) (:foreground "purple" :bold t))
2020 (((class color) (min-colors 8) (background dark)) (:foreground "cyan" :bold t))
2021 (t (:bold t))))
1975 "Face used for level 3 headlines." 2022 "Face used for level 3 headlines."
1976 :group 'org-faces) 2023 :group 'org-faces)
1977 2024
1978(defface org-level-4 ;; font-lock-comment-face 2025(defface org-level-4 ;; font-lock-comment-face
1979 '((((type tty pc) (class color) (background light)) (:foreground "red")) 2026 (org-compatible-face
1980 (((type tty pc) (class color) (background dark)) (:foreground "red1")) 2027 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
1981 (((class color) (background light)) (:foreground "Firebrick")) 2028 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
1982 (((class color) (background dark)) (:foreground "chocolate1")) 2029 (((class color) (min-colors 16) (background light)) (:foreground "red"))
1983 (t (:bold t :italic t))) 2030 (((class color) (min-colors 16) (background dark)) (:foreground "red1"))
2031 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
2032 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
2033 (t (:bold t))))
1984 "Face used for level 4 headlines." 2034 "Face used for level 4 headlines."
1985 :group 'org-faces) 2035 :group 'org-faces)
1986 2036
1987(defface org-level-5 ;; font-lock-type-face 2037(defface org-level-5 ;; font-lock-type-face
1988 '((((type tty) (class color)) (:foreground "green")) 2038 (org-compatible-face
1989 (((class color) (background light)) (:foreground "ForestGreen")) 2039 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen"))
1990 (((class color) (background dark)) (:foreground "PaleGreen")) 2040 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen"))
1991 (t (:bold t :underline t))) 2041 (((class color) (min-colors 8)) (:foreground "green"))))
1992 "Face used for level 5 headlines." 2042 "Face used for level 5 headlines."
1993 :group 'org-faces) 2043 :group 'org-faces)
1994 2044
1995(defface org-level-6 ;; font-lock-constant-face 2045(defface org-level-6 ;; font-lock-constant-face
1996 '((((type tty) (class color)) (:foreground "magenta")) 2046 (org-compatible-face
1997 (((class color) (background light)) (:foreground "CadetBlue")) 2047 '((((class color) (min-colors 16) (background light)) (:foreground "CadetBlue"))
1998 (((class color) (background dark)) (:foreground "Aquamarine")) 2048 (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine"))
1999 (t (:bold t :underline t))) 2049 (((class color) (min-colors 8)) (:foreground "magenta"))))
2000 "Face used for level 6 headlines." 2050 "Face used for level 6 headlines."
2001 :group 'org-faces) 2051 :group 'org-faces)
2002 2052
2003(defface org-level-7 ;; font-lock-builtin-face 2053(defface org-level-7 ;; font-lock-builtin-face
2004 '((((type tty) (class color)) (:foreground "blue" :weight light)) 2054 (org-compatible-face
2005 (((class color) (background light)) (:foreground "Orchid")) 2055 '((((class color) (min-colors 16) (background light)) (:foreground "Orchid"))
2006 (((class color) (background dark)) (:foreground "LightSteelBlue")) 2056 (((class color) (min-colors 16) (background dark)) (:foreground "LightSteelBlue"))
2007 (t (:bold t))) 2057 (((class color) (min-colors 8)) (:foreground "blue")))) ;; FIXME: for dark bg?
2008 "Face used for level 7 headlines." 2058 "Face used for level 7 headlines."
2009 :group 'org-faces) 2059 :group 'org-faces)
2010 2060
2011(defface org-level-8 ;; font-lock-string-face 2061(defface org-level-8 ;; font-lock-string-face
2012 '((((type tty) (class color)) (:foreground "green")) 2062 (org-compatible-face
2013 (((class color) (background light)) (:foreground "RosyBrown")) 2063 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
2014 (((class color) (background dark)) (:foreground "LightSalmon")) 2064 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
2015 (t (:italic t))) 2065 (((class color) (min-colors 8)) (:foreground "green"))))
2016 "Face used for level 8 headlines." 2066 "Face used for level 8 headlines."
2017 :group 'org-faces) 2067 :group 'org-faces)
2018 2068
2019(defface org-special-keyword ;; font-lock-string-face 2069(defface org-special-keyword ;; font-lock-string-face
2020 '((((type tty) (class color)) (:foreground "green")) 2070 (org-compatible-face
2021 (((class color) (background light)) (:foreground "RosyBrown")) 2071 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
2022 (((class color) (background dark)) (:foreground "LightSalmon")) 2072 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
2023 (t (:italic t))) 2073 (t (:italic t))))
2024 "Face used for special keywords." 2074 "Face used for special keywords."
2025 :group 'org-faces) 2075 :group 'org-faces)
2026 2076
2027(defface org-warning ;; font-lock-warning-face 2077(defface org-warning ;; font-lock-warning-face
2028 '((((type tty) (class color)) (:foreground "red")) 2078 (org-compatible-face
2029 (((class color) (background light)) (:foreground "Red" :bold t)) 2079 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
2030 (((class color) (background dark)) (:foreground "Red1" :bold t)) 2080 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
2031; (((class color) (background dark)) (:foreground "Pink" :bold t)) 2081 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
2032 (t (:inverse-video t :bold t))) 2082 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
2083 (t (:bold t))))
2033 "Face for deadlines and TODO keywords." 2084 "Face for deadlines and TODO keywords."
2034 :group 'org-faces) 2085 :group 'org-faces)
2035 2086
2036(defface org-headline-done ;; font-lock-string-face 2087(defface org-headline-done ;; font-lock-string-face
2037 '((((type tty) (class color)) (:foreground "green")) 2088 (org-compatible-face
2038 (((class color) (background light)) (:foreground "RosyBrown")) 2089 '((((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
2039 (((class color) (background dark)) (:foreground "LightSalmon")) 2090 (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
2040 (t (:italic t))) 2091 (((class color) (min-colors 8) (background light)) (:bold nil))))
2041 "Face used to indicate that a headline is DONE. See also the variable 2092 "Face used to indicate that a headline is DONE.
2042`org-fontify-done-headline'." 2093This face is only used if `org-fontify-done-headline' is set."
2043 :group 'org-faces)
2044
2045;; Inheritance does not work for xemacs. So we just copy...
2046
2047(defface org-deadline-announce
2048 '((((type tty) (class color)) (:foreground "blue" :weight bold))
2049 (((class color) (background light)) (:foreground "Blue"))
2050 (((class color) (background dark)) (:foreground "LightSkyBlue"))
2051 (t (:inverse-video t :bold t)))
2052 "Face for upcoming deadlines."
2053 :group 'org-faces)
2054
2055(defface org-scheduled-today
2056 '((((type tty) (class color)) (:foreground "green"))
2057 (((class color) (background light)) (:foreground "DarkGreen"))
2058 (((class color) (background dark)) (:foreground "PaleGreen"))
2059 (t (:bold t :underline t)))
2060 "Face for items scheduled for a certain day."
2061 :group 'org-faces)
2062
2063(defface org-scheduled-previously
2064 '((((type tty pc) (class color) (background light)) (:foreground "red"))
2065 (((type tty pc) (class color) (background dark)) (:foreground "red1"))
2066 (((class color) (background light)) (:foreground "Firebrick"))
2067 (((class color) (background dark)) (:foreground "chocolate1"))
2068 (t (:bold t :italic t)))
2069 "Face for items scheduled previously, and not yet done."
2070 :group 'org-faces)
2071
2072(defface org-formula
2073 '((((type tty pc) (class color) (background light)) (:foreground "red"))
2074 (((type tty pc) (class color) (background dark)) (:foreground "red1"))
2075 (((class color) (background light)) (:foreground "Firebrick"))
2076 (((class color) (background dark)) (:foreground "chocolate1"))
2077 (t (:bold t :italic t)))
2078 "Face for formulas."
2079 :group 'org-faces) 2094 :group 'org-faces)
2080 2095
2081(defface org-link 2096(defface org-link
2082 '((((type tty) (class color)) (:foreground "cyan" :weight bold)) 2097 '((((class color) (background light)) (:foreground "Purple" :underline t))
2083 (((class color) (background light)) (:foreground "Purple" :underline t))
2084 (((class color) (background dark)) (:foreground "Cyan" :underline t)) 2098 (((class color) (background dark)) (:foreground "Cyan" :underline t))
2085 (t (:bold t))) 2099 (t (:underline t)))
2086 "Face for links." 2100 "Face for links."
2087 :group 'org-faces) 2101 :group 'org-faces)
2088 2102
2089(defface org-date 2103(defface org-date
2090 '((((type tty) (class color)) (:foreground "cyan" :weight bold)) 2104 '((((class color) (background light)) (:foreground "Purple" :underline t))
2091 (((class color) (background light)) (:foreground "Purple" :underline t))
2092 (((class color) (background dark)) (:foreground "Cyan" :underline t)) 2105 (((class color) (background dark)) (:foreground "Cyan" :underline t))
2093 (t (:bold t))) 2106 (t (:underline t)))
2094 "Face for links." 2107 "Face for links."
2095 :group 'org-faces) 2108 :group 'org-faces)
2096 2109
2097(defface org-tag 2110(defface org-tag
2098 '((((type tty) (class color)) (:weight bold)) 2111 '((t (:bold t)))
2099 (((class color) (background light)) (:weight bold))
2100 (((class color) (background dark)) (:weight bold))
2101 (t (:bold t)))
2102 "Face for tags." 2112 "Face for tags."
2103 :group 'org-faces) 2113 :group 'org-faces)
2104 2114
2105(defface org-todo ;; font-lock-warning-face 2115(defface org-todo ;; font-lock-warning-face
2106 '((((type tty) (class color)) (:foreground "red")) 2116 (org-compatible-face
2107 (((class color) (background light)) (:foreground "Red" :bold t)) 2117 '((((class color) (min-colors 16) (background light)) (:foreground "Red1" :bold t))
2108 (((class color) (background dark)) (:foreground "Red1" :bold t)) 2118 (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :bold t))
2109; (((class color) (background dark)) (:foreground "Pink" :bold t)) 2119 (((class color) (min-colors 8) (background light)) (:foreground "red" :bold t))
2110 (t (:inverse-video t :bold t))) 2120 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
2121 (t (:inverse-video t :bold t))))
2111 "Face for TODO keywords." 2122 "Face for TODO keywords."
2112 :group 'org-faces) 2123 :group 'org-faces)
2113 2124
2114(defface org-done ;; font-lock-type-face 2125(defface org-done ;; font-lock-type-face
2115 '((((type tty) (class color)) (:foreground "green")) 2126 (org-compatible-face
2116 (((class color) (background light)) (:foreground "ForestGreen" :bold t)) 2127 '((((class color) (min-colors 16) (background light)) (:foreground "ForestGreen"))
2117 (((class color) (background dark)) (:foreground "PaleGreen" :bold t)) 2128 (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen"))
2118 (t (:bold t :underline t))) 2129 (((class color) (min-colors 8)) (:foreground "green"))
2130 (t (:bold t))))
2119 "Face used for DONE." 2131 "Face used for DONE."
2120 :group 'org-faces) 2132 :group 'org-faces)
2121 2133
2122(defface org-table ;; font-lock-function-name-face 2134(defface org-table ;; font-lock-function-name-face
2123 '((((type tty) (class color)) (:foreground "blue" :weight bold)) 2135 (org-compatible-face
2124 (((class color) (background light)) (:foreground "Blue")) 2136 '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
2125 (((class color) (background dark)) (:foreground "LightSkyBlue")) 2137 (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
2126 (t (:inverse-video t :bold t))) 2138 (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
2139 (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
2140 (((class color) (min-colors 8) (background light)) (:foreground "blue"))
2141 (((class color) (min-colors 8) (background dark)))))
2127 "Face used for tables." 2142 "Face used for tables."
2128 :group 'org-faces) 2143 :group 'org-faces)
2129 2144
2145(defface org-formula
2146 (org-compatible-face
2147 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
2148 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
2149 (((class color) (min-colors 8) (background light)) (:foreground "red"))
2150 (((class color) (min-colors 8) (background dark)) (:foreground "red"))
2151 (t (:bold t :italic t))))
2152 "Face for formulas."
2153 :group 'org-faces)
2154
2155(defface org-scheduled-today
2156 (org-compatible-face
2157 '((((class color) (min-colors 88) (background light)) (:foreground "DarkGreen"))
2158 (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
2159 (((class color) (min-colors 8)) (:foreground "green"))
2160 (t (:bold t :italic t))))
2161 "Face for items scheduled for a certain day."
2162 :group 'org-faces)
2163
2164(defface org-scheduled-previously
2165 (org-compatible-face
2166 '((((class color) (min-colors 88) (background light)) (:foreground "Firebrick"))
2167 (((class color) (min-colors 88) (background dark)) (:foreground "chocolate1"))
2168 (((class color) (min-colors 8) (background light)) (:foreground "red"))
2169 (((class color) (min-colors 8) (background dark)) (:foreground "red" :bold t))
2170 (t (:bold t))))
2171 "Face for items scheduled previously, and not yet done."
2172 :group 'org-faces)
2173
2130(defface org-time-grid ;; font-lock-variable-name-face 2174(defface org-time-grid ;; font-lock-variable-name-face
2131 '((((type tty) (class color)) (:foreground "yellow" :weight light)) 2175 (org-compatible-face
2132 (((class color) (background light)) (:foreground "DarkGoldenrod")) 2176 '((((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
2133 (((class color) (background dark)) (:foreground "LightGoldenrod")) 2177 (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
2134 (t (:bold t :italic t))) 2178 (((class color) (min-colors 8)) (:foreground "yellow" :weight light)))) ; FIXME: turn off???
2135 "Face used for time grids." 2179 "Face used for time grids."
2136 :group 'org-faces) 2180 :group 'org-faces)
2137 2181
2138(defvar org-level-faces 2182(defconst org-level-faces
2139 '(org-level-1 org-level-2 org-level-3 org-level-4 2183 '(org-level-1 org-level-2 org-level-3 org-level-4
2140 org-level-5 org-level-6 org-level-7 org-level-8 2184 org-level-5 org-level-6 org-level-7 org-level-8
2141 )) 2185 ))
2142(defvar org-n-levels (length org-level-faces)) 2186(defconst org-n-levels (length org-level-faces))
2143 2187
2188(defconst org-bold-re
2189 (if (featurep 'xemacs)
2190 "\\([ ]\\|^\\)\\(\\*\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)\\*\\)\\([ ,.]\\|$\\)"
2191 "\\([ ]\\|^\\)\\(\\*\\(\\w[[:word:] -_]*?\\w\\)\\*\\)\\([ ,.]\\|$\\)")
2192 "Regular expression for bold emphasis.")
2193(defconst org-italic-re
2194 (if (featurep 'xemacs)
2195 "\\([ ]\\|^\\)\\(/\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)/\\)\\([ ,.]\\|$\\)"
2196 "\\([ ]\\|^\\)\\(/\\(\\w[[:word:] -_]*?\\w\\)/\\)\\([ ,.]\\|$\\)")
2197 "Regular expression for italic emphasis.")
2198(defconst org-underline-re
2199 (if (featurep 'xemacs)
2200 "\\([ ]\\|^\\)\\(_\\(\\w[a-zA-Z0-9-_ ]*?\\w\\)_\\)\\([ ,.]\\|$\\)"
2201 "\\([ ]\\|^\\)\\(_\\(\\w[[:word:] -_]*?\\w\\)_\\)\\([ ,.]\\|$\\)")
2202 "Regular expression for underline emphasis.")
2144 2203
2145;; Variables for pre-computed regular expressions, all buffer local 2204;; Variables for pre-computed regular expressions, all buffer local
2146(defvar org-done-string nil 2205(defvar org-done-string nil
@@ -2215,6 +2274,7 @@ Changing this variable requires a restart of Emacs to take effect."
2215 (setq int 'type 2274 (setq int 'type
2216 kwds (append kwds (org-split-string value splitre)))) 2275 kwds (append kwds (org-split-string value splitre))))
2217 ((equal key "STARTUP") 2276 ((equal key "STARTUP")
2277 (debug)
2218 (let ((opts (org-split-string value splitre)) 2278 (let ((opts (org-split-string value splitre))
2219 (set '(("fold" org-startup-folded t) 2279 (set '(("fold" org-startup-folded t)
2220 ("overview" org-startup-folded t) 2280 ("overview" org-startup-folded t)
@@ -2728,9 +2788,12 @@ between words."
2728 (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) 2788 (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t))
2729 (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) 2789 (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t))
2730 (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t)) 2790 (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t))
2731 (if em '("\\(\\W\\|^\\)\\(\\*\\w+\\*\\)\\(\\W\\|$\\)" 2 'bold prepend)) 2791; (if em '("\\(\\W\\|^\\)\\(\\*\\w+\\*\\)\\(\\W\\|$\\)" 2 'bold prepend))
2732 (if em '("\\(\\W\\|^\\)\\(/\\w+/\\)\\(\\W\\|$\\)" 2 'italic prepend)) 2792; (if em '("\\(\\W\\|^\\)\\(/\\w+/\\)\\(\\W\\|$\\)" 2 'italic prepend))
2733 (if em '("\\(\\W\\|^\\)\\(_\\w+_\\)\\(\\W\\|$\\)" 2 'underline prepend)) 2793; (if em '("\\(\\W\\|^\\)\\(_\\w+_\\)\\(\\W\\|$\\)" 2 'underline prepend))
2794 (if em (list org-bold-re 2 ''bold 'prepend))
2795 (if em (list org-italic-re 2 ''italic 'prepend))
2796 (if em (list org-underline-re 2 ''underline 'prepend))
2734 (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string 2797 (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string
2735 "\\|" org-quote-string "\\)\\>") 2798 "\\|" org-quote-string "\\)\\>")
2736 '(1 'org-special-keyword t)) 2799 '(1 'org-special-keyword t))
@@ -3109,13 +3172,14 @@ or nil."
3109 (error (outline-next-heading))) 3172 (error (outline-next-heading)))
3110 (prog1 (match-string 0) 3173 (prog1 (match-string 0)
3111 (funcall outline-level))))) 3174 (funcall outline-level)))))
3112 (if (and (bolp) 3175 (cond
3113 (save-excursion (backward-char 1) (not (org-invisible-p)))) 3176 ((and (org-on-heading-p) (bolp)
3114 (open-line 1) 3177 (save-excursion (backward-char 1) (not (org-invisible-p))))
3115 (newline)) 3178 (open-line 1))
3179 ((bolp) nil)
3180 (t (newline)))
3116 (insert head) 3181 (insert head)
3117 (if (looking-at "[ \t]*") 3182 (just-one-space)
3118 (replace-match " "))
3119 (run-hooks 'org-insert-heading-hook)))) 3183 (run-hooks 'org-insert-heading-hook))))
3120 3184
3121(defun org-insert-item () 3185(defun org-insert-item ()
@@ -3128,8 +3192,20 @@ Return t when things worked, nil when we are not in an item."
3128 (org-at-item-p) 3192 (org-at-item-p)
3129 t) 3193 t)
3130 (error nil))) 3194 (error nil)))
3131 (unless (bolp) (newline)) 3195 (let* ((bul (match-string 0))
3132 (insert (match-string 0)) 3196 (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")
3197 (match-end 0)))
3198 (eowcol (save-excursion (goto-char eow) (current-column))))
3199 (cond
3200 ((and (org-at-item-p) (<= (point) eow))
3201 ;; before the bullet
3202 (beginning-of-line 1)
3203 (open-line 1))
3204 ((<= (point) eow)
3205 (beginning-of-line 1))
3206 (t (newline)))
3207 (insert bul)
3208 (just-one-space))
3133 (org-maybe-renumber-ordered-list) 3209 (org-maybe-renumber-ordered-list)
3134 t)) 3210 t))
3135 3211
@@ -5335,7 +5411,8 @@ for a keyword. A numeric prefix directly selects the Nth keyword in
5335 (completion-ignore-case t) 5411 (completion-ignore-case t)
5336 (org-select-this-todo-keyword 5412 (org-select-this-todo-keyword
5337 (if (stringp arg) arg 5413 (if (stringp arg) arg
5338 (and arg (integerp arg) (nth (1- arg) org-todo-keywords)))) 5414 (and arg (integerp arg) (> arg 0)
5415 (nth (1- arg) org-todo-keywords))))
5339 rtn rtnall files file pos) 5416 rtn rtnall files file pos)
5340 (when (equal arg '(4)) 5417 (when (equal arg '(4))
5341 (setq org-select-this-todo-keyword 5418 (setq org-select-this-todo-keyword
@@ -5935,6 +6012,7 @@ the documentation of `org-diary'."
5935 "Return the TODO information for agenda display." 6012 "Return the TODO information for agenda display."
5936 (let* ((props (list 'face nil 6013 (let* ((props (list 'face nil
5937 'done-face 'org-done 6014 'done-face 'org-done
6015 'org-not-done-regexp org-not-done-regexp
5938 'mouse-face 'highlight 6016 'mouse-face 'highlight
5939 'keymap org-agenda-keymap 6017 'keymap org-agenda-keymap
5940 'help-echo 6018 'help-echo
@@ -5975,6 +6053,7 @@ the documentation of `org-diary'."
5975(defun org-agenda-get-timestamps () 6053(defun org-agenda-get-timestamps ()
5976 "Return the date stamp information for agenda display." 6054 "Return the date stamp information for agenda display."
5977 (let* ((props (list 'face nil 6055 (let* ((props (list 'face nil
6056 'org-not-done-regexp org-not-done-regexp
5978 'mouse-face 'highlight 6057 'mouse-face 'highlight
5979 'keymap org-agenda-keymap 6058 'keymap org-agenda-keymap
5980 'help-echo 6059 'help-echo
@@ -6040,6 +6119,7 @@ the documentation of `org-diary'."
6040(defun org-agenda-get-closed () 6119(defun org-agenda-get-closed ()
6041 "Return the logged TODO entries for agenda display." 6120 "Return the logged TODO entries for agenda display."
6042 (let* ((props (list 'mouse-face 'highlight 6121 (let* ((props (list 'mouse-face 'highlight
6122 'org-not-done-regexp org-not-done-regexp
6043 'keymap org-agenda-keymap 6123 'keymap org-agenda-keymap
6044 'help-echo 6124 'help-echo
6045 (format "mouse-2 or RET jump to org file %s" 6125 (format "mouse-2 or RET jump to org file %s"
@@ -6091,6 +6171,7 @@ the documentation of `org-diary'."
6091 "Return the deadline information for agenda display." 6171 "Return the deadline information for agenda display."
6092 (let* ((wdays org-deadline-warning-days) 6172 (let* ((wdays org-deadline-warning-days)
6093 (props (list 'mouse-face 'highlight 6173 (props (list 'mouse-face 'highlight
6174 'org-not-done-regexp org-not-done-regexp
6094 'keymap org-agenda-keymap 6175 'keymap org-agenda-keymap
6095 'help-echo 6176 'help-echo
6096 (format "mouse-2 or RET jump to org file %s" 6177 (format "mouse-2 or RET jump to org file %s"
@@ -6146,6 +6227,7 @@ the documentation of `org-diary'."
6146(defun org-agenda-get-scheduled () 6227(defun org-agenda-get-scheduled ()
6147 "Return the scheduled information for agenda display." 6228 "Return the scheduled information for agenda display."
6148 (let* ((props (list 'face 'org-scheduled-previously 6229 (let* ((props (list 'face 'org-scheduled-previously
6230 'org-not-done-regexp org-not-done-regexp
6149 'undone-face 'org-scheduled-previously 6231 'undone-face 'org-scheduled-previously
6150 'done-face 'org-done 6232 'done-face 'org-done
6151 'mouse-face 'highlight 6233 'mouse-face 'highlight
@@ -6195,6 +6277,7 @@ the documentation of `org-diary'."
6195(defun org-agenda-get-blocks () 6277(defun org-agenda-get-blocks ()
6196 "Return the date-range information for agenda display." 6278 "Return the date-range information for agenda display."
6197 (let* ((props (list 'face nil 6279 (let* ((props (list 'face nil
6280 'org-not-done-regexp org-not-done-regexp
6198 'mouse-face 'highlight 6281 'mouse-face 'highlight
6199 'keymap org-agenda-keymap 6282 'keymap org-agenda-keymap
6200 'help-echo 6283 'help-echo
@@ -6430,8 +6513,25 @@ HH:MM."
6430 6513
6431(defun org-finalize-agenda-entries (list) 6514(defun org-finalize-agenda-entries (list)
6432 "Sort and concatenate the agenda items." 6515 "Sort and concatenate the agenda items."
6516 (setq list (mapcar 'org-agenda-highlight-todo list))
6433 (mapconcat 'identity (sort list 'org-entries-lessp) "\n")) 6517 (mapconcat 'identity (sort list 'org-entries-lessp) "\n"))
6434 6518
6519(defun org-agenda-highlight-todo (x)
6520 (let (re)
6521 (if (eq x 'line)
6522 (save-excursion
6523 (beginning-of-line 1)
6524 (setq re (get-text-property (point) 'org-not-done-regexp))
6525 (goto-char (+ (point) (get-text-property (point) 'prefix-length)))
6526 (and (looking-at (concat "[ \t]*" re))
6527 (add-text-properties (match-beginning 0) (match-end 0)
6528 '(face org-todo))))
6529 (setq re (get-text-property 0 'org-not-done-regexp x))
6530 (and re (string-match re x)
6531 (add-text-properties (match-beginning 0) (match-end 0)
6532 '(face org-todo) x))
6533 x)))
6534
6435(defsubst org-cmp-priority (a b) 6535(defsubst org-cmp-priority (a b)
6436 "Compare the priorities of string A and B." 6536 "Compare the priorities of string A and B."
6437 (let ((pa (or (get-text-property 1 'priority a) 0)) 6537 (let ((pa (or (get-text-property 1 'priority a) 0))
@@ -6582,7 +6682,7 @@ the same tree node, and the headline of the tree node in the Org-mode file."
6582 (and (outline-next-heading) 6682 (and (outline-next-heading)
6583 (org-flag-heading nil))) ; show the next heading 6683 (org-flag-heading nil))) ; show the next heading
6584 (org-todo arg) 6684 (org-todo arg)
6585 (forward-char 1) 6685 (and (bolp) (forward-char 1))
6586 (setq newhead (org-get-heading)) 6686 (setq newhead (org-get-heading))
6587 (save-excursion 6687 (save-excursion
6588 (org-back-to-heading) 6688 (org-back-to-heading)
@@ -6622,12 +6722,13 @@ the new TODO state."
6622 (replace-match new t t) 6722 (replace-match new t t)
6623 (beginning-of-line 1) 6723 (beginning-of-line 1)
6624 (add-text-properties (point-at-bol) (point-at-eol) props) 6724 (add-text-properties (point-at-bol) (point-at-eol) props)
6625 (if fixface 6725 (when fixface
6626 (add-text-properties 6726 (add-text-properties
6627 (point-at-bol) (point-at-eol) 6727 (point-at-bol) (point-at-eol)
6628 (list 'face 6728 (list 'face
6629 (if org-last-todo-state-is-todo 6729 (if org-last-todo-state-is-todo
6630 undone-face done-face)))) 6730 undone-face done-face)))
6731 (org-agenda-highlight-todo 'line))
6631 (beginning-of-line 1)) 6732 (beginning-of-line 1))
6632 (error "Line update did not work"))) 6733 (error "Line update did not work")))
6633 (beginning-of-line 0))))) 6734 (beginning-of-line 0)))))
@@ -7804,7 +7905,11 @@ If the file does not exist, an error is thrown."
7804 (setq cmd 'emacs)))) 7905 (setq cmd 'emacs))))
7805 (cond 7906 (cond
7806 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) 7907 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd)))
7807 (setq cmd (format cmd (concat "\"" file "\""))) 7908; (setq cmd (format cmd (concat "\"" file "\"")))
7909 ;; FIXME: normalize use of quotes
7910 (if (string-match "['\"]%s['\"]" cmd)
7911 (setq cmd (replace-match "'%s'" t t cmd)))
7912 (setq cmd (format cmd file))
7808 (save-window-excursion 7913 (save-window-excursion
7809 (shell-command (concat cmd " &")))) 7914 (shell-command (concat cmd " &"))))
7810 ((or (stringp cmd) 7915 ((or (stringp cmd)
@@ -8198,12 +8303,16 @@ is in the current directory or below."
8198 (complete-file 8303 (complete-file
8199 ;; Completing read for file names. 8304 ;; Completing read for file names.
8200 (setq file (read-file-name "File: ")) 8305 (setq file (read-file-name "File: "))
8201 (let ((pwd (file-name-as-directory (expand-file-name ".")))) 8306 (let ((pwd (file-name-as-directory (expand-file-name ".")))
8307 (pwd1 (file-name-as-directory (abbreviate-file-name
8308 (expand-file-name ".")))))
8202 (cond 8309 (cond
8203 ((equal complete-file '(16)) 8310 ((equal complete-file '(16))
8204 (setq link (org-make-link 8311 (setq link (org-make-link
8205 "file:" 8312 "file:"
8206 (abbreviate-file-name (expand-file-name file))))) 8313 (abbreviate-file-name (expand-file-name file)))))
8314 ((string-match (concat "^" (regexp-quote pwd1) "\\(.+\\)") file)
8315 (setq link (org-make-link "file:" (match-string 1 file))))
8207 ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)") 8316 ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)")
8208 (expand-file-name file)) 8317 (expand-file-name file))
8209 (setq link (org-make-link 8318 (setq link (org-make-link
@@ -11796,14 +11905,27 @@ headlines. The default is 3. Lower levels will become bulleted lists."
11796 ;; FILE link 11905 ;; FILE link
11797 (let* ((filename path) 11906 (let* ((filename path)
11798 (abs-p (file-name-absolute-p filename)) 11907 (abs-p (file-name-absolute-p filename))
11799 (thefile (if abs-p (expand-file-name filename) filename)) 11908 thefile file-is-image-p search)
11800 (thefile (save-match-data 11909 (save-match-data
11801 (if (string-match ":[0-9]+$" thefile) 11910 (if (string-match "::\\(.*\\)" filename)
11802 (replace-match "" t t thefile) 11911 (setq search (match-string 1 filename)
11803 thefile))) 11912 filename (replace-match "" nil nil filename)))
11804 (file-is-image-p 11913 (setq file-is-image-p
11805 (save-match-data 11914 (string-match (org-image-file-name-regexp) filename))
11806 (string-match (org-image-file-name-regexp) thefile)))) 11915 (setq thefile (if abs-p (expand-file-name filename) filename))
11916 (when (and org-export-html-link-org-files-as-html
11917 (string-match "\\.org$" thefile))
11918 (setq thefile (concat (substring thefile 0
11919 (match-beginning 0))
11920 ".html"))
11921 (if (and search
11922 ;; make sure this is can be used as target search
11923 (not (string-match "^[0-9]*$" search))
11924 (not (string-match "^\\*" search))
11925 (not (string-match "^/.*/$" search)))
11926 (setq thefile (concat thefile "#"
11927 (org-solidify-link-text
11928 (org-link-unescape search)))))))
11807 (setq rpl (if (and org-export-html-inline-images 11929 (setq rpl (if (and org-export-html-inline-images
11808 file-is-image-p) 11930 file-is-image-p)
11809 (concat "<img src=\"" thefile "\"/>") 11931 (concat "<img src=\"" thefile "\"/>")
@@ -12156,15 +12278,24 @@ stacked delimiters is N. Escaping delimiters is not possible."
12156 (setq string (replace-match (match-string 1 string) t t string)))) 12278 (setq string (replace-match (match-string 1 string) t t string))))
12157 string) 12279 string)
12158 12280
12281;(defun org-export-html-convert-emphasize (string)
12282; (let (c (s 0))
12283; (while (string-match "\\(\\W\\|^\\)\\([*/_]\\)\\(\\w+\\)\\2\\(\\W\\|$\\)" string s)
12284; (setq c (cdr (assoc (match-string 2 string)
12285; '(("*" . "b") ("/" . "i") ("_" . "u"))))
12286; s (+ (match-end 0) 3)
12287; string (replace-match
12288; (concat "\\1<" c ">\\3</" c ">\\4") t nil string)))
12289; string))
12290
12159(defun org-export-html-convert-emphasize (string) 12291(defun org-export-html-convert-emphasize (string)
12160 (let (c (s 0)) 12292 (while (string-match org-italic-re string)
12161 (while (string-match "\\(\\W\\|^\\)\\([*/_]\\)\\(\\w+\\)\\2\\(\\W\\|$\\)" string s) 12293 (setq string (replace-match "\\1<i>\\3</i>\\4" t nil string)))
12162 (setq c (cdr (assoc (match-string 2 string) 12294 (while (string-match org-bold-re string)
12163 '(("*" . "b") ("/" . "i") ("_" . "u")))) 12295 (setq string (replace-match "\\1<b>\\3</b>\\4" t nil string)))
12164 s (+ (match-end 0) 3) 12296 (while (string-match org-underline-re string)
12165 string (replace-match 12297 (setq string (replace-match "\\1<u>\\3</u>\\4" t nil string)))
12166 (concat "\\1<" c ">\\3</" c ">\\4") t nil string))) 12298 string)
12167 string))
12168 12299
12169(defun org-parse-key-lines () 12300(defun org-parse-key-lines ()
12170 "Find the special key lines with the information for exporters." 12301 "Find the special key lines with the information for exporters."