Bläddra i källkod

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.
Kyle Meyer 9 år sedan
förälder
incheckning
eb3b1046c6
1 ändrade filer med 1 tillägg och 3 borttagningar
  1. 1 3
      lisp/org-src.el

+ 1 - 3
lisp/org-src.el

@@ -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