aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Dominik2006-03-13 07:08:15 +0000
committerCarsten Dominik2006-03-13 07:08:15 +0000
commit4ed31842857221fb932a51539a2c32ebd6cceeb6 (patch)
tree2ffd36a6f0dde3343941d7840bcba129b2f3367f
parentda63ece4730cb1479179dc96380d1a37f3f80108 (diff)
downloademacs-4ed31842857221fb932a51539a2c32ebd6cceeb6.tar.gz
emacs-4ed31842857221fb932a51539a2c32ebd6cceeb6.zip
(org-link-search): Avoid self-matching of links, allow
target text to be distributed over several lines. (org-search-not-link): New function. (org-set-regexps-and-options, org-get-current-options): New startup options. (org-export-as-html): Take odd-level setting from local variable. (org-fontify-emphasized-text): New option. (org-set-font-lock-defaults): Include emphasized text. (org-follow-mhe-link): Allow folder-only links, fix folder name. (org-font-lock): Customize group renamed from `org-faces'.
-rw-r--r--lisp/textmodes/org.el311
1 files changed, 193 insertions, 118 deletions
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index 717455edc61..3c77560a9cc 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.08 8;; Version: 4.09
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -81,8 +81,14 @@
81;; 81;;
82;; Changes since version 4.00: 82;; Changes since version 4.00:
83;; --------------------------- 83;; ---------------------------
84;; Version 4.08 84;; Version 4.09
85;; - Bug fixes.
86;; - Small improvements to font-lock support.
87;; - MHE support finalized.
85;; 88;;
89;; Version 4.08
90;; - Bug fixes.
91;; - Improved MHE support
86;; 92;;
87;; Version 4.07 93;; Version 4.07
88;; - Bug fixes. 94;; - Bug fixes.
@@ -139,7 +145,7 @@
139 145
140;;; Customization variables 146;;; Customization variables
141 147
142(defvar org-version "4.08" 148(defvar org-version "4.09"
143 "The version number of the file org.el.") 149 "The version number of the file org.el.")
144(defun org-version () 150(defun org-version ()
145 (interactive) 151 (interactive)
@@ -796,31 +802,15 @@ as possible."
796 :group 'org-structure 802 :group 'org-structure
797 :type 'hook) 803 :type 'hook)
798 804
799(defcustom org-level-color-stars-only nil
800 "Non-nil means fontify only the stars in each headline.
801When nil, the entire headline is fontified.
802Changing it requires restart of `font-lock-mode' to become effective."
803 :group 'org-structure
804 :type 'boolean)
805
806(defcustom org-hide-leading-stars nil
807 "Non-nil means, hide the first N-1 stars in a headline.
808This works by using the face `org-hide' for these stars. This
809face is white for a light background, and black for a dark
810background. You may have to customize the face `org-hide' to
811make this work.
812Changing it requires restart of `font-lock-mode' to become effective."
813 :group 'org-structure
814 :type 'boolean)
815
816(defcustom org-odd-levels-only nil 805(defcustom org-odd-levels-only nil
817 "Non-nil means, skip even levels and only use odd levels for the outline. 806 "Non-nil means, skip even levels and only use odd levels for the outline.
818This has the effect that two stars are being added/taken away in 807This has the effect that two stars are being added/taken away in
819promotion/demotion commands. It also influences how levels are 808promotion/demotion commands. It also influences how levels are
820handled by the exporters. 809handled by the exporters.
821Changing it requires restart of `font-lock-mode' to become effective 810Changing it requires restart of `font-lock-mode' to become effective
822for fontification." 811for fontification also in regions already fontified."
823 :group 'org-structure 812 :group 'org-structure
813 :group 'org-font-lock
824 :type 'boolean) 814 :type 'boolean)
825 815
826(defcustom org-adapt-indentation t 816(defcustom org-adapt-indentation t
@@ -1710,11 +1700,44 @@ This file is created with the command \\[org-export-icalendar-all-agenda-files].
1710 :group 'org-export 1700 :group 'org-export
1711 :type 'string) 1701 :type 'string)
1712 1702
1713(defgroup org-faces nil 1703(defgroup org-font-lock nil
1714 "Faces for highlighting in Org-mode." 1704 "Faces and settings for highlighting in Org-mode."
1715 :tag "Org Faces" 1705 :tag "Org Font Lock"
1716 :group 'org) 1706 :group 'org)
1717 1707
1708(defcustom org-level-color-stars-only nil
1709 "Non-nil means fontify only the stars in each headline.
1710When nil, the entire headline is fontified.
1711Changing it requires restart of `font-lock-mode' to become effective
1712also in regions already fontified."
1713 :group 'org-font-lock
1714 :type 'boolean)
1715
1716(defcustom org-hide-leading-stars nil
1717 "Non-nil means, hide the first N-1 stars in a headline.
1718This works by using the face `org-hide' for these stars. This
1719face is white for a light background, and black for a dark
1720background. You may have to customize the face `org-hide' to
1721make this work.
1722Changing it requires restart of `font-lock-mode' to become effective
1723also in regions already fontified."
1724 :group 'org-font-lock
1725 :type 'boolean)
1726
1727(defcustom org-fontify-done-headline nil
1728 "Non-nil means, change the face of a headline if it is marked DONE.
1729Normally, only the TODO/DONE keyword indicates the state of a headline.
1730When this is non-nil, the headline after the keyword is set to the
1731`org-headline-done' as an additional indication."
1732 :group 'org-font-lock
1733 :type 'boolean)
1734
1735(defcustom org-fontify-emphasized-text t
1736 "Non-nil means fontify *bold*, /italic/ and _underlined_ text.
1737Changing this variable requires a restart of Emacs to take effect."
1738 :group 'org-font-lock
1739 :type 'boolean)
1740
1718(defface org-hide 1741(defface org-hide
1719 '((((type tty) (class color)) (:foreground "blue" :weight bold)) 1742 '((((type tty) (class color)) (:foreground "blue" :weight bold))
1720 (((class color) (background light)) (:foreground "white")) 1743 (((class color) (background light)) (:foreground "white"))
@@ -1723,7 +1746,7 @@ This file is created with the command \\[org-export-icalendar-all-agenda-files].
1723; (((class color) (background dark)) (:foreground "grey10")) 1746; (((class color) (background dark)) (:foreground "grey10"))
1724 (t (:inverse-video nil))) 1747 (t (:inverse-video nil)))
1725 "Face used for level 1 headlines." 1748 "Face used for level 1 headlines."
1726 :group 'org-faces) 1749 :group 'org-font-lock)
1727 1750
1728(defface org-level-1 ;; font-lock-function-name-face 1751(defface org-level-1 ;; font-lock-function-name-face
1729 '((((type tty) (class color)) (:foreground "blue" :weight bold)) 1752 '((((type tty) (class color)) (:foreground "blue" :weight bold))
@@ -1731,7 +1754,7 @@ This file is created with the command \\[org-export-icalendar-all-agenda-files].
1731 (((class color) (background dark)) (:foreground "LightSkyBlue")) 1754 (((class color) (background dark)) (:foreground "LightSkyBlue"))
1732 (t (:inverse-video t :bold t))) 1755 (t (:inverse-video t :bold t)))
1733 "Face used for level 1 headlines." 1756 "Face used for level 1 headlines."
1734 :group 'org-faces) 1757 :group 'org-font-lock)
1735 1758
1736(defface org-level-2 ;; font-lock-variable-name-face 1759(defface org-level-2 ;; font-lock-variable-name-face
1737 '((((type tty) (class color)) (:foreground "yellow" :weight light)) 1760 '((((type tty) (class color)) (:foreground "yellow" :weight light))
@@ -1739,7 +1762,7 @@ This file is created with the command \\[org-export-icalendar-all-agenda-files].
1739 (((class color) (background dark)) (:foreground "LightGoldenrod")) 1762 (((class color) (background dark)) (:foreground "LightGoldenrod"))
1740 (t (:bold t :italic t))) 1763 (t (:bold t :italic t)))
1741 "Face used for level 2 headlines." 1764 "Face used for level 2 headlines."
1742 :group 'org-faces) 1765 :group 'org-font-lock)
1743 1766
1744(defface org-level-3 ;; font-lock-keyword-face 1767(defface org-level-3 ;; font-lock-keyword-face
1745 '((((type tty) (class color)) (:foreground "cyan" :weight bold)) 1768 '((((type tty) (class color)) (:foreground "cyan" :weight bold))
@@ -1747,7 +1770,7 @@ This file is created with the command \\[org-export-icalendar-all-agenda-files].
1747 (((class color) (background dark)) (:foreground "Cyan")) 1770 (((class color) (background dark)) (:foreground "Cyan"))
1748 (t (:bold t))) 1771 (t (:bold t)))
1749 "Face used for level 3 headlines." 1772 "Face used for level 3 headlines."
1750 :group 'org-faces) 1773 :group 'org-font-lock)
1751 1774
1752(defface org-level-4 ;; font-lock-comment-face 1775(defface org-level-4 ;; font-lock-comment-face
1753 '((((type tty pc) (class color) (background light)) (:foreground "red")) 1776 '((((type tty pc) (class color) (background light)) (:foreground "red"))
@@ -1756,7 +1779,7 @@ This file is created with the command \\[org-export-icalendar-all-agenda-files].
1756 (((class color) (background dark)) (:foreground "chocolate1")) 1779 (((class color) (background dark)) (:foreground "chocolate1"))
1757 (t (:bold t :italic t))) 1780 (t (:bold t :italic t)))
1758 "Face used for level 4 headlines." 1781 "Face used for level 4 headlines."
1759 :group 'org-faces) 1782 :group 'org-font-lock)
1760 1783
1761(defface org-level-5 ;; font-lock-type-face 1784(defface org-level-5 ;; font-lock-type-face
1762 '((((type tty) (class color)) (:foreground "green")) 1785 '((((type tty) (class color)) (:foreground "green"))
@@ -1764,7 +1787,7 @@ This file is created with the command \\[org-export-icalendar-all-agenda-files].
1764 (((class color) (background dark)) (:foreground "PaleGreen")) 1787 (((class color) (background dark)) (:foreground "PaleGreen"))
1765 (t (:bold t :underline t))) 1788 (t (:bold t :underline t)))
1766 "Face used for level 5 headlines." 1789 "Face used for level 5 headlines."
1767 :group 'org-faces) 1790 :group 'org-font-lock)
1768 1791
1769(defface org-level-6 ;; font-lock-constant-face 1792(defface org-level-6 ;; font-lock-constant-face
1770 '((((type tty) (class color)) (:foreground "magenta")) 1793 '((((type tty) (class color)) (:foreground "magenta"))
@@ -1772,7 +1795,7 @@ This file is created with the command \\[org-export-icalendar-all-agenda-files].
1772 (((class color) (background dark)) (:foreground "Aquamarine")) 1795 (((class color) (background dark)) (:foreground "Aquamarine"))
1773 (t (:bold t :underline t))) 1796 (t (:bold t :underline t)))
1774 "Face used for level 6 headlines." 1797 "Face used for level 6 headlines."
1775 :group 'org-faces) 1798 :group 'org-font-lock)
1776 1799
1777(defface org-level-7 ;; font-lock-builtin-face 1800(defface org-level-7 ;; font-lock-builtin-face
1778 '((((type tty) (class color)) (:foreground "blue" :weight light)) 1801 '((((type tty) (class color)) (:foreground "blue" :weight light))
@@ -1780,7 +1803,7 @@ This file is created with the command \\[org-export-icalendar-all-agenda-files].
1780 (((class color) (background dark)) (:foreground "LightSteelBlue")) 1803 (((class color) (background dark)) (:foreground "LightSteelBlue"))
1781 (t (:bold t))) 1804 (t (:bold t)))
1782 "Face used for level 7 headlines." 1805 "Face used for level 7 headlines."
1783 :group 'org-faces) 1806 :group 'org-font-lock)
1784 1807
1785(defface org-level-8 ;; font-lock-string-face 1808(defface org-level-8 ;; font-lock-string-face
1786 '((((type tty) (class color)) (:foreground "green")) 1809 '((((type tty) (class color)) (:foreground "green"))
@@ -1788,7 +1811,7 @@ This file is created with the command \\[org-export-icalendar-all-agenda-files].
1788 (((class color) (background dark)) (:foreground "LightSalmon")) 1811 (((class color) (background dark)) (:foreground "LightSalmon"))
1789 (t (:italic t))) 1812 (t (:italic t)))
1790 "Face used for level 8 headlines." 1813 "Face used for level 8 headlines."
1791 :group 'org-faces) 1814 :group 'org-font-lock)
1792 1815
1793(defface org-special-keyword ;; font-lock-string-face 1816(defface org-special-keyword ;; font-lock-string-face
1794 '((((type tty) (class color)) (:foreground "green")) 1817 '((((type tty) (class color)) (:foreground "green"))
@@ -1796,7 +1819,7 @@ This file is created with the command \\[org-export-icalendar-all-agenda-files].
1796 (((class color) (background dark)) (:foreground "LightSalmon")) 1819 (((class color) (background dark)) (:foreground "LightSalmon"))
1797 (t (:italic t))) 1820 (t (:italic t)))
1798 "Face used for special keywords." 1821 "Face used for special keywords."
1799 :group 'org-faces) 1822 :group 'org-font-lock)
1800 1823
1801(defface org-warning ;; font-lock-warning-face 1824(defface org-warning ;; font-lock-warning-face
1802 '((((type tty) (class color)) (:foreground "red")) 1825 '((((type tty) (class color)) (:foreground "red"))
@@ -1805,15 +1828,7 @@ This file is created with the command \\[org-export-icalendar-all-agenda-files].
1805; (((class color) (background dark)) (:foreground "Pink" :bold t)) 1828; (((class color) (background dark)) (:foreground "Pink" :bold t))
1806 (t (:inverse-video t :bold t))) 1829 (t (:inverse-video t :bold t)))
1807 "Face for deadlines and TODO keywords." 1830 "Face for deadlines and TODO keywords."
1808 :group 'org-faces) 1831 :group 'org-font-lock)
1809
1810(defcustom org-fontify-done-headline nil
1811 "Non-nil means, change the face of a headline if it is marked DONE.
1812Normally, only the TODO/DONE keyword indicates the state of a headline.
1813When this is non-nil, the headline after the keyword is set to the
1814`org-headline-done' as an additional indication."
1815 :group 'org-faces
1816 :type 'boolean)
1817 1832
1818(defface org-headline-done ;; font-lock-string-face 1833(defface org-headline-done ;; font-lock-string-face
1819 '((((type tty) (class color)) (:foreground "green")) 1834 '((((type tty) (class color)) (:foreground "green"))
@@ -1822,7 +1837,7 @@ When this is non-nil, the headline after the keyword is set to the
1822 (t (:italic t))) 1837 (t (:italic t)))
1823 "Face used to indicate that a headline is DONE. See also the variable 1838 "Face used to indicate that a headline is DONE. See also the variable
1824`org-fontify-done-headline'." 1839`org-fontify-done-headline'."
1825 :group 'org-faces) 1840 :group 'org-font-lock)
1826 1841
1827;; Inheritance does not yet work for xemacs. So we just copy... 1842;; Inheritance does not yet work for xemacs. So we just copy...
1828 1843
@@ -1832,7 +1847,7 @@ When this is non-nil, the headline after the keyword is set to the
1832 (((class color) (background dark)) (:foreground "LightSkyBlue")) 1847 (((class color) (background dark)) (:foreground "LightSkyBlue"))
1833 (t (:inverse-video t :bold t))) 1848 (t (:inverse-video t :bold t)))
1834 "Face for upcoming deadlines." 1849 "Face for upcoming deadlines."
1835 :group 'org-faces) 1850 :group 'org-font-lock)
1836 1851
1837(defface org-scheduled-today 1852(defface org-scheduled-today
1838 '((((type tty) (class color)) (:foreground "green")) 1853 '((((type tty) (class color)) (:foreground "green"))
@@ -1840,7 +1855,7 @@ When this is non-nil, the headline after the keyword is set to the
1840 (((class color) (background dark)) (:foreground "PaleGreen")) 1855 (((class color) (background dark)) (:foreground "PaleGreen"))
1841 (t (:bold t :underline t))) 1856 (t (:bold t :underline t)))
1842 "Face for items scheduled for a certain day." 1857 "Face for items scheduled for a certain day."
1843 :group 'org-faces) 1858 :group 'org-font-lock)
1844 1859
1845(defface org-scheduled-previously 1860(defface org-scheduled-previously
1846 '((((type tty pc) (class color) (background light)) (:foreground "red")) 1861 '((((type tty pc) (class color) (background light)) (:foreground "red"))
@@ -1849,7 +1864,7 @@ When this is non-nil, the headline after the keyword is set to the
1849 (((class color) (background dark)) (:foreground "chocolate1")) 1864 (((class color) (background dark)) (:foreground "chocolate1"))
1850 (t (:bold t :italic t))) 1865 (t (:bold t :italic t)))
1851 "Face for items scheduled previously, and not yet done." 1866 "Face for items scheduled previously, and not yet done."
1852 :group 'org-faces) 1867 :group 'org-font-lock)
1853 1868
1854(defface org-formula 1869(defface org-formula
1855 '((((type tty pc) (class color) (background light)) (:foreground "red")) 1870 '((((type tty pc) (class color) (background light)) (:foreground "red"))
@@ -1858,7 +1873,7 @@ When this is non-nil, the headline after the keyword is set to the
1858 (((class color) (background dark)) (:foreground "chocolate1")) 1873 (((class color) (background dark)) (:foreground "chocolate1"))
1859 (t (:bold t :italic t))) 1874 (t (:bold t :italic t)))
1860 "Face for formulas." 1875 "Face for formulas."
1861 :group 'org-faces) 1876 :group 'org-font-lock)
1862 1877
1863(defface org-link 1878(defface org-link
1864 '((((type tty) (class color)) (:foreground "cyan" :weight bold)) 1879 '((((type tty) (class color)) (:foreground "cyan" :weight bold))
@@ -1866,15 +1881,15 @@ When this is non-nil, the headline after the keyword is set to the
1866 (((class color) (background dark)) (:foreground "Cyan")) 1881 (((class color) (background dark)) (:foreground "Cyan"))
1867 (t (:bold t))) 1882 (t (:bold t)))
1868 "Face for links." 1883 "Face for links."
1869 :group 'org-faces) 1884 :group 'org-font-lock)
1870 1885
1871(defface org-tag 1886(defface org-tag
1872 '((((type tty) (class color)) (:foreground "cyan" :weight bold)) 1887 '((((type tty) (class color)) (:foreground "cyan" :weight bold))
1873 (((class color) (background light)) (:foreground "Purple" :weight bold)) 1888 (((class color) (background light)) (:foreground "Purple" :weight bold))
1874 (((class color) (background dark)) (:foreground "Cyan" :weight bold)) 1889 (((class color) (background dark)) (:foreground "Cyan" :weight bold))
1875 (t (:bold t))) 1890 (t (:bold t)))
1876 "Face for links." 1891 "Face for tags."
1877 :group 'org-faces) 1892 :group 'org-font-lock)
1878 1893
1879(defface org-done ;; font-lock-type-face 1894(defface org-done ;; font-lock-type-face
1880 '((((type tty) (class color)) (:foreground "green")) 1895 '((((type tty) (class color)) (:foreground "green"))
@@ -1882,7 +1897,7 @@ When this is non-nil, the headline after the keyword is set to the
1882 (((class color) (background dark)) (:foreground "PaleGreen" :bold t)) 1897 (((class color) (background dark)) (:foreground "PaleGreen" :bold t))
1883 (t (:bold t :underline t))) 1898 (t (:bold t :underline t)))
1884 "Face used for DONE." 1899 "Face used for DONE."
1885 :group 'org-faces) 1900 :group 'org-font-lock)
1886 1901
1887(defface org-table ;; font-lock-function-name-face 1902(defface org-table ;; font-lock-function-name-face
1888 '((((type tty) (class color)) (:foreground "blue" :weight bold)) 1903 '((((type tty) (class color)) (:foreground "blue" :weight bold))
@@ -1890,7 +1905,7 @@ When this is non-nil, the headline after the keyword is set to the
1890 (((class color) (background dark)) (:foreground "LightSkyBlue")) 1905 (((class color) (background dark)) (:foreground "LightSkyBlue"))
1891 (t (:inverse-video t :bold t))) 1906 (t (:inverse-video t :bold t)))
1892 "Face used for tables." 1907 "Face used for tables."
1893 :group 'org-faces) 1908 :group 'org-font-lock)
1894 1909
1895(defface org-time-grid ;; font-lock-variable-name-face 1910(defface org-time-grid ;; font-lock-variable-name-face
1896 '((((type tty) (class color)) (:foreground "yellow" :weight light)) 1911 '((((type tty) (class color)) (:foreground "yellow" :weight light))
@@ -1898,7 +1913,7 @@ When this is non-nil, the headline after the keyword is set to the
1898 (((class color) (background dark)) (:foreground "LightGoldenrod")) 1913 (((class color) (background dark)) (:foreground "LightGoldenrod"))
1899 (t (:bold t :italic t))) 1914 (t (:bold t :italic t)))
1900 "Face used for time grids." 1915 "Face used for time grids."
1901 :group 'org-faces) 1916 :group 'org-font-lock)
1902 1917
1903(defvar org-level-faces 1918(defvar org-level-faces
1904 '(org-level-1 org-level-2 org-level-3 org-level-4 1919 '(org-level-1 org-level-2 org-level-3 org-level-4
@@ -1939,6 +1954,10 @@ When this is non-nil, the headline after the keyword is set to the
1939 (set '(("fold" org-startup-folded t) 1954 (set '(("fold" org-startup-folded t)
1940 ("nofold" org-startup-folded nil) 1955 ("nofold" org-startup-folded nil)
1941 ("content" org-startup-folded content) 1956 ("content" org-startup-folded content)
1957 ("hidestars" org-hide-leading-stars t)
1958 ("showstars" org-hide-leading-stars nil)
1959 ("odd" org-odd-levels-only t)
1960 ("oddeven" org-odd-levels-only nil)
1942 ("dlcheck" org-startup-with-deadline-check t) 1961 ("dlcheck" org-startup-with-deadline-check t)
1943 ("nodlcheck" org-startup-with-deadline-check nil))) 1962 ("nodlcheck" org-startup-with-deadline-check nil)))
1944 l var val) 1963 l var val)
@@ -2307,44 +2326,45 @@ between words."
2307(defvar org-font-lock-keywords nil) 2326(defvar org-font-lock-keywords nil)
2308 2327
2309(defun org-set-font-lock-defaults () 2328(defun org-set-font-lock-defaults ()
2310 (let ((org-font-lock-extra-keywords 2329 (let* ((em org-fontify-emphasized-text)
2311 (list 2330 (org-font-lock-extra-keywords
2312 '("^\\(\\**\\)\\(\\*\\)\\(.*\\)" (1 (org-get-level-face 1)) 2331 (list
2313 (2 (org-get-level-face 2)) (3 (org-get-level-face 3))) 2332 '("^\\(\\**\\)\\(\\*\\)\\(.*\\)" (1 (org-get-level-face 1))
2314 '(org-activate-links (0 'org-link t)) 2333 (2 (org-get-level-face 2)) (3 (org-get-level-face 3)))
2315 '(org-activate-links2 (0 'org-link t)) 2334 '(org-activate-links (0 'org-link t))
2316 '(org-activate-target-links (0 'org-link t)) 2335 '(org-activate-links2 (0 'org-link t))
2317 '(org-activate-dates (0 'org-link t)) 2336 '(org-activate-target-links (0 'org-link t))
2318 '(org-activate-camels (0 'org-link t)) 2337 '(org-activate-dates (0 'org-link t))
2319 '(org-activate-tags (1 'org-tag t)) 2338 '(org-activate-camels (0 'org-link t))
2320 (list (concat "^\\*+[ \t]*" org-not-done-regexp) 2339 '(org-activate-tags (1 'org-tag t))
2321 '(1 'org-warning t)) 2340 (list (concat "^\\*+[ \t]*" org-not-done-regexp)
2322 (list (concat "\\[#[A-Z]\\]") '(0 'org-special-keyword t)) 2341 '(1 'org-warning t))
2323 (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) 2342 (list (concat "\\[#[A-Z]\\]") '(0 'org-special-keyword t))
2324 (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) 2343 (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t))
2325 (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t)) 2344 (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t))
2326 ;; '("\\(\\s-\\|^\\)\\(\\*\\([a-zA-Z]+\\)\\*\\)\\([^a-zA-Z*]\\|$\\)" 2345 (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t))
2327 ;; (3 'bold)) 2346; (if em '("\\(\\s-\\|^\\)\\(\\*\\([a-zA-Z]+\\)\\*\\)\\([^a-zA-Z*]\\|$\\)" (3 'bold)))
2328 ;; '("\\(\\s-\\|^\\)\\(/\\([a-zA-Z]+\\)/\\)\\([^a-zA-Z*]\\|$\\)" 2347; (if em '("\\(\\s-\\|^\\)\\(/\\([a-zA-Z]+\\)/\\)\\([^a-zA-Z*]\\|$\\)" (3 'italic)))
2329 ;; (3 'italic)) 2348; (if em '("\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)" (3 'underline)))
2330 ;; '("\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)" 2349 (if em '("\\*[a-zA-Z]+\\*" 0 'bold))
2331 ;; (3 'underline)) 2350 (if em '("/*[a-zA-Z]+/" 0 'italic))
2332 (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string 2351 (if em '("_[a-zA-Z]+_" 0 'underline))
2333 "\\|" org-quote-string "\\)\\>") 2352 (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string
2334 '(1 'org-special-keyword t)) 2353 "\\|" org-quote-string "\\)\\>")
2335 '("^#.*" (0 'font-lock-comment-face t)) 2354 '(1 'org-special-keyword t))
2336 (if org-fontify-done-headline 2355 '("^#.*" (0 'font-lock-comment-face t))
2337 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\(.*\\)\\>") 2356 (if org-fontify-done-headline
2338 '(1 'org-done t) '(2 'org-headline-done t)) 2357 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\(.*\\)\\>")
2339 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\>") 2358 '(1 'org-done t) '(2 'org-headline-done t))
2340 '(1 'org-done t))) 2359 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\>")
2341 '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)" 2360 '(1 'org-done t)))
2342 (1 'org-table t)) 2361 '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
2343 '("^[ \t]*\\(:.*\\)" (1 'org-table t)) 2362 (1 'org-table t))
2344 '("| *\\(:?=[^|\n]*\\)" (1 'org-formula t)) 2363 '("^[ \t]*\\(:.*\\)" (1 'org-table t))
2345 '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t)) 2364 '("| *\\(:?=[^|\n]*\\)" (1 'org-formula t))
2346 ))) 2365 '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t))
2347 2366 )))
2367 (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords))
2348 ;; Now set the full font-lock-keywords 2368 ;; Now set the full font-lock-keywords
2349 (set (make-local-variable 'org-font-lock-keywords) 2369 (set (make-local-variable 'org-font-lock-keywords)
2350 org-font-lock-extra-keywords) 2370 org-font-lock-extra-keywords)
@@ -6960,7 +6980,7 @@ in all files."
6960 (s0 (mapconcat 'identity (org-split-string s "[ \t\r\n]+") " ")) 6980 (s0 (mapconcat 'identity (org-split-string s "[ \t\r\n]+") " "))
6961 (pos (point)) 6981 (pos (point))
6962 (pre "") (post "") 6982 (pre "") (post "")
6963 words re0 re1 re2 re3 re4 re5 reall camel) 6983 words re0 re1 re2 re3 re4 re5 re2a reall camel)
6964 (cond ((save-excursion 6984 (cond ((save-excursion
6965 (goto-char (point-min)) 6985 (goto-char (point-min))
6966 (and 6986 (and
@@ -6995,11 +7015,13 @@ in all files."
6995 (org-split-string s "[ \n\r\t]+")) 7015 (org-split-string s "[ \n\r\t]+"))
6996 re0 (concat "<<" (regexp-quote s0) ">>") 7016 re0 (concat "<<" (regexp-quote s0) ">>")
6997 re2 (concat "\\<" (mapconcat 'downcase words "[ \t]+") "\\>") 7017 re2 (concat "\\<" (mapconcat 'downcase words "[ \t]+") "\\>")
7018 re2a (concat "\\<" (mapconcat 'downcase words "[ \t\r\n]+") "\\>")
6998 re4 (concat "\\<" (mapconcat 'downcase words "[^a-zA-Z_\r\n]+") "\\>") 7019 re4 (concat "\\<" (mapconcat 'downcase words "[^a-zA-Z_\r\n]+") "\\>")
6999 re1 (concat pre re2 post) 7020 re1 (concat pre re2 post)
7000 re3 (concat pre re4 post) 7021 re3 (concat pre re4 post)
7001 re5 (concat pre ".*" re4) 7022 re5 (concat pre ".*" re4)
7002 re2 (concat pre re2) 7023 re2 (concat pre re2)
7024 re2a (concat pre re2a)
7003 re4 (concat pre re4) 7025 re4 (concat pre re4)
7004 reall (concat "\\(" re0 "\\)\\|\\(" re1 "\\)\\|\\(" re2 7026 reall (concat "\\(" re0 "\\)\\|\\(" re1 "\\)\\|\\(" re2
7005 "\\)\\|\\(" re3 "\\)\\|\\(" re4 "\\)\\|\\(" 7027 "\\)\\|\\(" re3 "\\)\\|\\(" re4 "\\)\\|\\("
@@ -7009,12 +7031,14 @@ in all files."
7009 ((eq type 'org-occur) (org-occur reall)) 7031 ((eq type 'org-occur) (org-occur reall))
7010 ((eq type 'occur) (org-do-occur (downcase reall) 'cleanup)) 7032 ((eq type 'occur) (org-do-occur (downcase reall) 'cleanup))
7011 (t (goto-char (point-min)) 7033 (t (goto-char (point-min))
7012 (if (or (re-search-forward re0 nil t) 7034 (if (or (org-search-not-link re0 nil t)
7013 (re-search-forward re1 nil t) 7035 (org-search-not-link re1 nil t)
7014 (re-search-forward re2 nil t) 7036 (org-search-not-link re2 nil t)
7015 (re-search-forward re3 nil t) 7037 (org-search-not-link re2a nil t) ;; FIXME: Right place???
7016 (re-search-forward re4 nil t) 7038 (org-search-not-link re3 nil t)
7017 (re-search-forward re5 nil t)) 7039 (org-search-not-link re4 nil t)
7040 (org-search-not-link re5 nil t)
7041 )
7018 (goto-char (match-beginning 0)) 7042 (goto-char (match-beginning 0))
7019 (goto-char pos) 7043 (goto-char pos)
7020 (error "No match"))))) 7044 (error "No match")))))
@@ -7026,6 +7050,21 @@ in all files."
7026 (error "No match")))) 7050 (error "No match"))))
7027 (and (eq major-mode 'org-mode) (org-show-hierarchy-above)))) 7051 (and (eq major-mode 'org-mode) (org-show-hierarchy-above))))
7028 7052
7053(defun org-search-not-link (&rest args)
7054 "Execute `re-search-forward', but only accept matches that are not a link."
7055 (catch 'exit
7056 (let ((pos (point)) p1)
7057 (while (apply 're-search-forward args)
7058 (setq p1 (point))
7059 (if (not (save-match-data
7060 (and (re-search-backward "\\[\\[" nil t)
7061 (looking-at org-bracket-link-regexp)
7062 (<= (match-beginning 0) p1)
7063 (>= (match-end 0) p1))))
7064 (progn (goto-char (match-end 0))
7065 (throw 'exit (point)))
7066 (goto-char (match-end 0)))))))
7067
7029(defun org-do-occur (regexp &optional cleanup) 7068(defun org-do-occur (regexp &optional cleanup)
7030 "Call the Emacs command `occur'. 7069 "Call the Emacs command `occur'.
7031If CLEANUP is non-nil, remove the printout of the regular expression 7070If CLEANUP is non-nil, remove the printout of the regular expression
@@ -7284,24 +7323,32 @@ idea..."
7284 header-field))) 7323 header-field)))
7285 7324
7286(defun org-follow-mhe-link (folder article) 7325(defun org-follow-mhe-link (folder article)
7287 "Follow an MHE link to FOLDER and ARTICLE." 7326 "Follow an MHE link to FOLDER and ARTICLE.
7288 (setq article (org-add-angle-brackets article)) 7327If ARTICLE is nil FOLDER is shown. If the configuration variable
7328`org-mhe-search-all-folders' is t and `mh-searcher' is pick,
7329ARTICLE is searched in all folders. Indexed searches (swish++,
7330namazu, and others supported by MH-E) will always search in all
7331folders."
7289 (require 'mh-e) 7332 (require 'mh-e)
7290 (require 'mh-search) 7333 (require 'mh-search)
7334 (require 'mh-utils)
7291 (mh-find-path) 7335 (mh-find-path)
7292 (mh-search-choose) 7336 (if (not article)
7293 (if (equal mh-searcher 'pick) 7337 (mh-visit-folder (mh-normalize-folder-name folder))
7294 (progn 7338 (setq article (org-add-angle-brackets article))
7295 (mh-search folder (list "--message-id" article)) 7339 (mh-search-choose)
7296 (when (and org-mhe-search-all-folders 7340 (if (equal mh-searcher 'pick)
7297 (not (org-mhe-get-message-real-folder))) 7341 (progn
7298 (kill-this-buffer) 7342 (mh-search folder (list "--message-id" article))
7299 (mh-search "+" (list "--message-id" article)))) 7343 (when (and org-mhe-search-all-folders
7300 (mh-search "+" article)) 7344 (not (org-mhe-get-message-real-folder)))
7301 (if (org-mhe-get-message-real-folder) 7345 (kill-this-buffer)
7302 (mh-show-msg 1) 7346 (mh-search "+" (list "--message-id" article))))
7303 (kill-this-buffer) 7347 (mh-search "+" article))
7304 (error "Message not found"))) 7348 (if (org-mhe-get-message-real-folder)
7349 (mh-show-msg 1)
7350 (kill-this-buffer)
7351 (error "Message not found"))))
7305 7352
7306(defun org-open-file (path &optional in-emacs line search) 7353(defun org-open-file (path &optional in-emacs line search)
7307 "Open the file at PATH. 7354 "Open the file at PATH.
@@ -10563,7 +10610,7 @@ translations. There is currently no way for users to extend this.")
10563This will leave level 1 alone, convert level 2 to level 3, level 3 to 10610This will leave level 1 alone, convert level 2 to level 3, level 3 to
10564level 5 etc." 10611level 5 etc."
10565 (interactive) 10612 (interactive)
10566 (when (yes-or-no-p "Are you sure you want to globally change levels? ") 10613 (when (yes-or-no-p "Are you sure you want to globally change levels to odd? ")
10567 (let ((org-odd-levels-only nil) n) 10614 (let ((org-odd-levels-only nil) n)
10568 (save-excursion 10615 (save-excursion
10569 (goto-char (point-min)) 10616 (goto-char (point-min))
@@ -10573,6 +10620,28 @@ level 5 etc."
10573 (org-demote)) 10620 (org-demote))
10574 (end-of-line 1)))))) 10621 (end-of-line 1))))))
10575 10622
10623
10624(defun org-convert-to-oddeven-levels ()
10625 "Convert an org-mode file with only odd levels to one with odd and even levels.
10626This promotes level 3 to level 2, level 5 to level 3 etc. If the file contains a
10627section with an even level, conversion would destroy the structure of the file. An error
10628is signaled in this case."
10629 (interactive)
10630 (goto-char (point-min))
10631 ;; First check if there are no even levels
10632 (when (re-search-forward "^\\(\\*\\*\\)+[^*]" nil t)
10633 (org-show-hierarchy-above)
10634 (error "Not all levels are odd in this file. Conversion not possible."))
10635 (when (yes-or-no-p "Are you sure you want to globally change levels to odd-even? ")
10636 (let ((org-odd-levels-only nil) n)
10637 (save-excursion
10638 (goto-char (point-min))
10639 (while (re-search-forward "^\\*\\*+" nil t)
10640 (setq n (/ (length (match-string 0)) 2))
10641 (while (>= (setq n (1- n)) 0)
10642 (org-promote))
10643 (end-of-line 1))))))
10644
10576(defun org-tr-level (n) 10645(defun org-tr-level (n)
10577 "Make N odd if required." 10646 "Make N odd if required."
10578 (if org-odd-levels-only (1+ (/ n 2)) n)) 10647 (if org-odd-levels-only (1+ (/ n 2)) n))
@@ -10817,7 +10886,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
10817#+CATEGORY: %s 10886#+CATEGORY: %s
10818#+SEQ_TODO: %s 10887#+SEQ_TODO: %s
10819#+TYP_TODO: %s 10888#+TYP_TODO: %s
10820#+STARTUP: %s %s 10889#+STARTUP: %s %s %s %s
10821#+ARCHIVE: %s 10890#+ARCHIVE: %s
10822" 10891"
10823 (buffer-name) (user-full-name) user-mail-address org-export-default-language 10892 (buffer-name) (user-full-name) user-mail-address org-export-default-language
@@ -10841,6 +10910,8 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
10841 (cdr (assoc org-startup-folded 10910 (cdr (assoc org-startup-folded
10842 '((nil . "nofold")(t . "fold")(content . "content")))) 10911 '((nil . "nofold")(t . "fold")(content . "content"))))
10843 (if org-startup-with-deadline-check "dlcheck" "nodlcheck") 10912 (if org-startup-with-deadline-check "dlcheck" "nodlcheck")
10913 (if org-odd-levels-only "odd" "oddeven")
10914 (if org-hide-leading-stars "hidestars" "showstars")
10844 org-archive-location 10915 org-archive-location
10845 )) 10916 ))
10846 10917
@@ -10924,6 +10995,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
10924 (setq-default org-deadline-line-regexp org-deadline-line-regexp) 10995 (setq-default org-deadline-line-regexp org-deadline-line-regexp)
10925 (setq-default org-done-string org-done-string) 10996 (setq-default org-done-string org-done-string)
10926 (let* ((style org-export-html-style) 10997 (let* ((style org-export-html-style)
10998 (odd org-odd-levels-only)
10927 (region-p (org-region-active-p)) 10999 (region-p (org-region-active-p))
10928 (region 11000 (region
10929 (buffer-substring 11001 (buffer-substring
@@ -10987,7 +11059,8 @@ headlines. The default is 3. Lower levels will become bulleted lists."
10987 (switch-to-buffer-other-window buffer)) 11059 (switch-to-buffer-other-window buffer))
10988 (erase-buffer) 11060 (erase-buffer)
10989 (fundamental-mode) 11061 (fundamental-mode)
10990 (let ((case-fold-search nil)) 11062 (let ((case-fold-search nil)
11063 (org-odd-levels-only odd))
10991 (if options (org-parse-export-options options)) 11064 (if options (org-parse-export-options options))
10992 (setq umax (if arg (prefix-numeric-value arg) 11065 (setq umax (if arg (prefix-numeric-value arg)
10993 org-export-headline-levels)) 11066 org-export-headline-levels))
@@ -12372,7 +12445,8 @@ See the individual commands for more information."
12372 "--" 12445 "--"
12373 ["Archive Subtree" org-archive-subtree t] 12446 ["Archive Subtree" org-archive-subtree t]
12374 "--" 12447 "--"
12375 ["Convert file to odd levels" org-convert-to-odd-levels t]) 12448 ["Convert to odd levels" org-convert-to-odd-levels t]
12449 ["Convert to odd/even levels" org-convert-to-oddeven-levels t])
12376 "--" 12450 "--"
12377 ("TODO Lists" 12451 ("TODO Lists"
12378 ["TODO/DONE/-" org-todo t] 12452 ["TODO/DONE/-" org-todo t]
@@ -12851,3 +12925,4 @@ Show the heading too, if it is currently invisible."
12851 12925
12852;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd 12926;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
12853;;; org.el ends here 12927;;; org.el ends here
12928