|
@@ -4204,6 +4204,49 @@ will be prompted for."
|
|
|
'(display t invisible t intangible t))
|
|
|
t)))
|
|
|
|
|
|
+(defun org-fontify-meta-lines (limit)
|
|
|
+ (let ((case-fold-search t))
|
|
|
+ (if (re-search-forward
|
|
|
+ "^\\([ \t]*#\\+\\(\\([a-zA-Z]+:?\\)\\(_[a-zA-Z]+\\)?\\)\\(.*\\)\\)"
|
|
|
+ limit t)
|
|
|
+ (let ((beg (match-beginning 0))
|
|
|
+ (beg1 (line-beginning-position 2))
|
|
|
+ (dc1 (downcase (match-string 2)))
|
|
|
+ (dc3 (downcase (match-string 3)))
|
|
|
+ end end1)
|
|
|
+ (cond
|
|
|
+ ((member dc1 '("html:" "ascii:" "latex:" "docbook:"))
|
|
|
+ ;; a single line of backend-specific content
|
|
|
+ (remove-text-properties (match-beginning 0) (match-end 0)
|
|
|
+ '(display t invisible t intangible t))
|
|
|
+ (add-text-properties (match-beginning 1) (match-end 3)
|
|
|
+ '(font-lock-fontified t face org-meta-line))
|
|
|
+ (add-text-properties (match-beginning 5) (match-end 5)
|
|
|
+ '(font-lock-fontified t face org-block))
|
|
|
+ t)
|
|
|
+ ((and (match-end 4) (equal dc3 "begin"))
|
|
|
+ ;; Truely a block
|
|
|
+ (when (re-search-forward
|
|
|
+ (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*")
|
|
|
+ nil t) ;; on purpose, we look further than LIMIT
|
|
|
+ (setq end (match-end 0) end1 (1- (match-beginning 0)))
|
|
|
+ (remove-text-properties beg end
|
|
|
+ '(display t invisible t intangible t))
|
|
|
+ (add-text-properties
|
|
|
+ beg end
|
|
|
+ '(font-lock-fontified t font-lock-multiline t))
|
|
|
+ (add-text-properties beg beg1 '(face org-meta-line))
|
|
|
+ (add-text-properties end1 end '(face org-meta-line))
|
|
|
+ (add-text-properties beg1 end1 '(face org-block))
|
|
|
+ t))
|
|
|
+ ((not (member (char-after beg) '(?\ ?\t)))
|
|
|
+ ;; just any other in-buffer setting, but not indented
|
|
|
+ (add-text-properties
|
|
|
+ beg (match-end 0)
|
|
|
+ '(font-lock-fontified t face org-meta-line))
|
|
|
+ t)
|
|
|
+ (t nil))))))
|
|
|
+
|
|
|
(defun org-activate-angle-links (limit)
|
|
|
"Run through the buffer and add overlays to links."
|
|
|
(if (re-search-forward org-angle-link-re limit t)
|
|
@@ -4537,6 +4580,8 @@ between words."
|
|
|
"\\|" org-quote-string "\\)\\>")
|
|
|
'(1 'org-special-keyword t))
|
|
|
'("^#.*" (0 'font-lock-comment-face t))
|
|
|
+ ;; Blocks and meta lines
|
|
|
+ '(org-fontify-meta-lines)
|
|
|
)))
|
|
|
(setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords))
|
|
|
;; Now set the full font-lock-keywords
|