GNU bug report logs -
#71604
diff--get-revision-properties calls set-auto-mode twice
Previous Next
Reported by: Dmitry Gutov <dmitry <at> gutov.dev>
Date: Mon, 17 Jun 2024 02:26:02 UTC
Severity: normal
Tags: patch
Done: Dmitry Gutov <dmitry <at> gutov.dev>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 71604 <at> debbugs.gnu.org (full text, mbox):
> vc-find-revision-no-save calls set-auto-mode, and then we repeat that call
> in diff-syntax-fontify-props.
>
> Which is a problem with CC Mode because it parses the buffer inside the
> major mode function, and ends up doing that twice, at least the first time
> the buffer is initialized before being saved to revision cache. Not exactly
> double the work, but more work nevertheless.
>
> This is a split off from https://debbugs.gnu.org/61667#587. I thought
> I recalled an existing report of vc-diff being slow, but apparently not.
>
> @@ -2883,9 +2883,6 @@ diff--get-revision-properties
> (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))))
> @@ -2905,7 +2902,8 @@ diff--get-revision-properties
> (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)))))
Thanks, looks correct.
This bug report was last modified 1 year and 34 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.