Lars Ingebrigtsen writes: > Juri Linkov writes: > >> This patch broke vc-diff. For example, after 'C-x v L' type 'd', >> and check that *vc-diff* buffer doesn't have buffer-local variables >> diff-vc-backend, diff-vc-revisions anymore, because they were defined >> in vc-diff-internal after diff-mode, but now the postponed diff-mode >> kills these buffer-local variables: >> >> (set-buffer buffer) >> - (diff-mode) >> (setq-local diff-vc-backend (car vc-fileset)) >> (setq-local diff-vc-revisions (list rev1 rev2)) > > Right. Matthias -- can this be fixed in a different way that doesn't > postpone changing the major mode? Thanks Juri! I moved the call to `diff-mode` since in its implementation one initialize `diff-buffer-type` by searching: (save-excursion (setq-local diff-buffer-type (if (re-search-forward "^diff --git" nil t) 'git nil))) I suggest to restore the original call to `diff-mode` (before the asynchronous operation completes) and keep the initialization of `diff-buffer-type` by searching but make it available to `vc-diff-finish' which is called when the asynchronous operation completes. See the attached patch for details.