0

When I move around the buffer *vc-diff* from vc-root-diff I experience lags.

GNU Emacs 27.1 (build 1, x86_64-pc-cygwin) of 2020-10-29.

With procmon I detected lots of:

C:\opt\cygwin64\bin\git.exe --no-pager ls-files -z --full-name -- application.yml
C:\opt\cygwin64\bin\git.exe --no-pager cat-file blob 4f6e63900c275c7c53519ac0a2f6bc1cdd65abf8:application.yml

that generated for each new file in diff...

It is from vc-git-find-revision.

Even though I enabled debugging on entering that function Emacs didn't stop there, so I cannot get stack trace which hook is responsible to process spawning.

I want to disable that "feature".

UPDATE 2023-04-10 Bug report: Emacs keeps opening related file from vc-diff buffer

gavenkoa
  • 3,352
  • 19
  • 36

1 Answers1

2

I already had an issue with hunk refinement, that fixed by:

;; Since 27.1 it is enabled during font-lock. Need to disable explicitly.
(setq diff-refine nil)

So I checked /usr/share/emacs/27.1/lisp/vc/diff-mode.el.gz again and found:

(defcustom diff-font-lock-syntax t)                          

So basically Emacs opens file behind in order to build proper syntax highlighting. That triggers slow VC commands. Yes, Cygwin is slow on fork().

Solution:

(setq diff-font-lock-syntax 'hunk-only)

I think it is a bug that Emacs tries to do vc-git-find-revision behind the scene when diff-font-lock-syntax it t. Exhausted to report it ((

alper
  • 1,238
  • 11
  • 30
gavenkoa
  • 3,352
  • 19
  • 36