Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name (diff-syntax-fontify-props)

From: Stefan Monnier <[email-masked]>
Date: Sun, 02 Feb 2020 08:50:07 -0500

> vc-find-revision-no-save also calls set-auto-mode.  So, I don't know if
> the following patch is correct, but together with your patch it does
> solve the original issue.
>
> diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
> index f64b6c0631..c50ba132e7 100644
> --- a/lisp/vc/vc.el
> +++ b/lisp/vc/vc.el
> @@ -2098,7 +2098,7 @@ vc-find-revision-no-save
>                      ;; For non-interactive, skip any questions
>                      (let ((enable-local-variables :safe) ;; to find `mode:'
>                            (buffer-file-name file))
> -                      (ignore-errors (set-auto-mode)))
> +                      (ignore-errors (delay-mode-hooks (set-auto-mode))))
>                    (normal-mode))
>  	        (set-buffer-modified-p nil)
>                  (setq buffer-read-only t))

How 'bout we first consolidate the two cases into one by introducing
a new function `set-auto-mode-for-filename` that both
vc-find-revision-no-save and diff-mode can use?

        Stefan