From eb3b1046c6cfd30c3810d48ea1db64b2f9a4b22d Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Fri, 29 Jan 2016 00:10:08 -0500 Subject: [PATCH] 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. --- lisp/org-src.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lisp/org-src.el b/lisp/org-src.el index 4f5899481..b7bbf31f9 100644 --- a/lisp/org-src.el +++ b/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