Browse Source

Re-use hidden language major mode buffers during code fontification

	* org-src.el (org-src-font-lock-fontify-block): Re-use hidden
	language major mode buffers during fontification
Dan Davison 14 years ago
parent
commit
abfc2cc30e
1 changed files with 5 additions and 2 deletions
  1. 5 2
      lisp/org-src.el

+ 5 - 2
lisp/org-src.el

@@ -726,9 +726,12 @@ fontification of code blocks see `org-src-fontify-block' and
 	 (modified (buffer-modified-p))
 	 (org-buffer (current-buffer)) pos next)
     (remove-text-properties start end '(face nil))
-    (with-temp-buffer
+    (with-current-buffer
+	(get-buffer-create
+	 (concat " org-src-fontification:" (symbol-name lang-mode)))
+      (delete-region (point-min) (point-max))
       (insert string)
-      (funcall lang-mode)
+      (unless (eq major-mode lang-mode) (funcall lang-mode))
       (font-lock-fontify-buffer)
       (setq pos (point-min))
       (while (setq next (next-single-property-change pos 'face))