浏览代码

Properly fontify short captions

* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Properly fontify
  short captions.
Nicolas Goaziou 8 年之前
父节点
当前提交
a94493f5a2
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      lisp/org.el

+ 7 - 3
lisp/org.el

@@ -6092,13 +6092,17 @@ by a #."
 	   (if (string-equal dc1 "+title:")
 	       '(font-lock-fontified t face org-document-title)
 	     '(font-lock-fontified t face org-document-info))))
-	 ((equal dc1 "+caption:")
+	 ((string-prefix-p "+caption" dc1)
 	  (org-remove-flyspell-overlays-in (match-end 2) (match-end 0))
 	  (remove-text-properties (match-beginning 0) (match-end 0)
 				  '(display t invisible t intangible t))
-	  (add-text-properties (match-beginning 1) (match-end 3)
+	  ;; Handle short captions.
+	  (save-excursion
+	    (beginning-of-line)
+	    (looking-at "\\([ \t]*#\\+caption\\(?:\\[.*\\]\\)?:\\)[ \t]*"))
+	  (add-text-properties (line-beginning-position) (match-end 1)
 			       '(font-lock-fontified t face org-meta-line))
-	  (add-text-properties (match-beginning 6) (+ (match-end 6) 1)
+	  (add-text-properties (match-end 0) (line-end-position)
 			       '(font-lock-fontified t face org-block))
 	  t)
 	 ((member dc3 '(" " ""))