From f13368b0becb67cd8484c394acd992ff6d5642a8 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Mon, 17 Jun 2024 22:51:23 +0300 Subject: [PATCH] diff-mode: Optimize source language syntax highlighting * lisp/vc/diff-mode.el (diff--get-revision-properties): Never pass FILE to 'diff-syntax-fontify-props'; assume that 'vc-find-revision-no-save' has called the major mode function already (bug#71604). (cherry picked from commit f7953a0eef4bf6505352c199a2f8ae8f3563fdfa) --- lisp/vc/diff-mode.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 5e74bc381ba..f1193885d6e 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -2894,9 +2894,6 @@ and the position in MAX." (buffer (cdr entry))) (if (buffer-live-p buffer) (progn - ;; Don't re-initialize the buffer (which would throw - ;; away the previous fontification work). - (setq file nil) (setq diff--cached-revision-buffers (cons entry (delq entry diff--cached-revision-buffers)))) @@ -2916,7 +2913,8 @@ and the position in MAX." (diff--cache-schedule-clean) (and buffer (with-current-buffer buffer - (diff-syntax-fontify-props file text line-nb))))) + ;; Major mode is set in vc-find-revision-no-save already. + (diff-syntax-fontify-props nil text line-nb))))) (defun diff-syntax-fontify-hunk (beg end old) "Highlight source language syntax in diff hunk between BEG and END. -- 2.39.2