org-src: Use font-lock-ensure to highlight blocks

* lisp/org-src.el (org-src-font-lock-fontify-block): Use
  org-font-lock-ensure instead of font-lock-fontify-buffer.

This replacement has previously been made (f36b19e, d81e6b5) and then reverted
(99f9999, 003a0f1) twice because source blocks were not being reliably
highlighted when font-lock-ensure was used instead of
font-lock-fontify-buffer.  This was due to a bug in font-lock-ensure
that has now been fixed (see Emacs's 21beb19 and bug#22399).

font-lock-ensure was introduced after Emacs 24.5, so this issue only
pertains to users with a developmental version of Emacs.
This commit is contained in:
Kyle Meyer 2016-01-29 00:10:08 -05:00
parent a4edee4069
commit eb3b1046c6
1 changed files with 1 additions and 3 deletions

View File

@ -496,9 +496,7 @@ as `org-src-fontify-natively' is non-nil."
(delete-region (point-min) (point-max))
(insert string " ") ;; so there's a final property change
(unless (eq major-mode lang-mode) (funcall lang-mode))
;; Avoid `font-lock-ensure', which does not display fonts in
;; source block.
(font-lock-fontify-buffer)
(org-font-lock-ensure)
(setq pos (point-min))
(while (setq next (next-single-property-change pos 'face))
(put-text-property