diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index f210d440b69..b0821de3da5 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -2799,13 +2799,15 @@ Return t if the buffer had changes, nil otherwise." ;; bindings are nicer for read only buffers. pcl-cvs does the ;; same thing. (setq buffer-read-only t) - (diff-mode) - (setq-local diff-vc-backend (car vc-fileset)) - (setq-local diff-vc-revisions (list rev1 rev2)) - (setq-local revert-buffer-function - (lambda (_ignore-auto _noconfirm) - (vc-diff-internal async vc-fileset rev1 rev2 verbose))) - (vc-call-backend (car vc-fileset) 'diff files rev1 rev2 buffer async) + (delay-mode-hooks + (diff-mode) + (setq-local diff-vc-backend (car vc-fileset)) + (setq-local diff-vc-revisions (list rev1 rev2)) + (setq-local revert-buffer-function + (lambda (_ignore-auto _noconfirm) + (vc-diff-internal async vc-fileset rev1 rev2 verbose))) + (vc-call-backend (car vc-fileset) 'diff files rev1 rev2 buffer async)) + (run-mode-hooks 'diff-mode-hook) (if (and (zerop (buffer-size)) (not (get-buffer-process (current-buffer)))) ;; Treat this case specially so as not to pop the buffer.