/
org-icons.patch
128 lines (127 loc) · 5.48 KB
/
org-icons.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
diff --git a/lisp/org.el b/lisp/org.el
index 300303b..e6caf9b 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4513,8 +4513,9 @@ between words."
;; Call the hook
'(org-font-lock-hook)
;; Headlines
- '("^\\(\\**\\)\\(\\* \\)\\(.*\\)" (1 (org-get-level-face 1))
- (2 (org-get-level-face 2)) (3 (org-get-level-face 3)))
+ ;'("^\\(\\**\\)\\(\\* \\)\\(.*\\)" (1 (org-get-level-face 1))
+ ; (2 (org-get-level-face 2)) (3 (org-get-level-face 3)))
+ '(org-font-lock-add-headline-faces)
;; Table lines
'("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
(1 'org-table t))
@@ -4524,8 +4525,9 @@ between words."
'("^[ \t]*|\\( *\\([$!_^/]\\) *|.*\\)|" (1 'org-formula t))
'("| *\\(<[lr]?[0-9]*>\\)" (1 'org-formula t))
;; Drawers
- (list org-drawer-regexp '(0 'org-special-keyword t))
- (list "^[ \t]*:END:" '(0 'org-special-keyword t))
+ ;(list org-drawer-regexp '(0 'org-special-keyword t))
+ ;(list "^[ \t]*:END:" '(0 'org-special-keyword t))
+ '(org-font-lock-add-drawer-faces)
;; Properties
(list org-property-re
'(1 'org-special-keyword t)
@@ -4541,25 +4543,18 @@ between words."
(2 'org-footnote t)))
'("^&?%%(.*\\|<%%([^>\n]*?>" (0 'org-sexp-date t))
'(org-hide-wide-columns (0 nil append))
- ;; TODO lines
- (list (concat "^\\*+[ \t]+" org-todo-regexp "\\([ \t]\\|$\\)")
- '(1 (org-get-todo-face 1) t))
- ;; DONE
- (if org-fontify-done-headline
- (list (concat "^[*]+ +\\<\\("
- (mapconcat 'regexp-quote org-done-keywords "\\|")
- "\\)\\(.*\\)")
- '(2 'org-headline-done t))
- nil)
+ ;; TODO states
+ '(org-font-lock-add-todo-state-faces)
;; Priorities
'(org-font-lock-add-priority-faces)
;; Tags
'(org-font-lock-add-tag-faces)
;; Special keywords
- (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t))
- (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t))
- (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t))
- (list (concat "\\<" org-clock-string) '(0 'org-special-keyword t))
+ '(org-font-lock-add-special-keyword-faces)
+ ;(list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t))
+ ;(list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t))
+ ;(list (concat "\\<" org-closed-string) '(0 'org-special-keyword t))
+ ;(list (concat "\\<" org-clock-string) '(0 'org-special-keyword t))
;; Emphasis
(if em
(if (featurep 'xemacs)
@@ -4634,6 +4629,66 @@ If KWD is a number, get the corresponding match group."
'font-lock-fontified t))
(backward-char 1))))
+(defun org-font-lock-add-headline-faces (limit)
+ "Add the headline faces."
+ (while (re-search-forward "^\\(\\**\\)\\(\\* \\)\\(.*\\)" limit t)
+ (progn
+ (add-text-properties
+ (match-beginning 1) (match-end 1)
+ (list 'face (org-get-level-face 1) 'font-lock-fontified t))
+ (add-text-properties
+ (match-beginning 2) (match-end 2)
+ (list 'face (org-get-level-face 2) 'font-lock-fontified t))
+ (add-text-properties
+ (match-beginning 3) (match-end 3)
+ (list 'face (org-get-level-face 3) 'font-lock-fontified t)))))
+
+(defun org-font-lock-add-todo-state-faces (limit)
+ "Add the todo state faces."
+ (while (re-search-forward (concat "^\\*+[ \t]+" org-todo-regexp "\\(.*\\|$\\)") limit t)
+ (progn
+ ;; TODO lines
+ (add-text-properties
+ (match-beginning 1) (match-end 1) (list 'face (org-get-todo-face 1) 'font-lock-fontified t))
+ ;; DONE
+ ;; This part is buggy (sorry)
+ (if org-fontify-done-headline
+ (save-excursion
+ (when (re-search-backward (concat "[ \t]+\\<\\("
+ (mapconcat 'regexp-quote org-done-keywords "\\|")
+ "\\)\\(.*\\)")
+ (match-end 1) t)
+ (add-text-properties
+ (match-beginning 1) (match-end 1) (list 'face 'org-headline-done 'font-lock-fontified t))))
+ nil))))
+
+(defun org-font-lock-add-special-keyword-faces (limit)
+ (progn
+ (save-excursion (while (re-search-forward (concat "\\<" org-deadline-string) limit t)
+ (add-text-properties (match-beginning 0) (match-end 0)
+ (list 'face 'org-special-keyword 'font-lock-fontified t))))
+ (save-excursion (while (re-search-forward (concat "\\<" org-scheduled-string) limit t)
+ (add-text-properties (match-beginning 0) (match-end 0)
+ (list 'face 'org-special-keyword 'font-lock-fontified t))))
+ (save-excursion (while (re-search-forward (concat "\\<" org-closed-string) limit t)
+ (add-text-properties (match-beginning 0) (match-end 0)
+ (list 'face 'org-special-keyword 'font-lock-fontified t))))
+ (save-excursion (while (re-search-forward (concat "\\<" org-clock-string) limit t)
+ (add-text-properties (match-beginning 0) (match-end 0)
+ (list 'face 'org-special-keyword 'font-lock-fontified t))))
+))
+
+(defun org-font-lock-add-drawer-faces (limit)
+ "Add the drawer faces."
+ (progn
+ (save-excursion
+ (while (re-search-forward org-drawer-regexp limit t)
+ (add-text-properties
+ (match-beginning 0) (match-end 0) (list 'face 'org-special-keyword 'font-lock-fontified t))))
+ (while (re-search-forward "^[ \t]*:END:" limit t)
+ (add-text-properties
+ (match-beginning 0) (match-end 0) (list 'face 'org-special-keyword 'font-lock-fontified t)))))
+
(defun org-font-lock-add-priority-faces (limit)
"Add the special priority faces."
(while (re-search-forward "\\[#\\([A-Z0-9]\\)\\]" limit t)