Properly fontify short captions

* lisp/org.el (org-fontify-meta-lines-and-blocks-1): Properly fontify
  short captions.
This commit is contained in:
Nicolas Goaziou 2016-10-29 01:09:26 +02:00
parent 7bbe9202c2
commit a94493f5a2

View file

@ -6092,13 +6092,17 @@ by a #."
(if (string-equal dc1 "+title:") (if (string-equal dc1 "+title:")
'(font-lock-fontified t face org-document-title) '(font-lock-fontified t face org-document-title)
'(font-lock-fontified t face org-document-info)))) '(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)) (org-remove-flyspell-overlays-in (match-end 2) (match-end 0))
(remove-text-properties (match-beginning 0) (match-end 0) (remove-text-properties (match-beginning 0) (match-end 0)
'(display t invisible t intangible t)) '(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)) '(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)) '(font-lock-fontified t face org-block))
t) t)
((member dc3 '(" " "")) ((member dc3 '(" " ""))