* lisp/vc/vc.el (vc-diff-internal): Use delay-mode-hooks.

This commit is contained in:
Sean Whitton 2025-12-14 10:51:08 +00:00
parent d481b9efdc
commit 699fb56b4e

View file

@ -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.