Subject: bug#40967: 27.0.50; vc-diff in indirect buffers

From: Nathan Moreau <[email-masked]>
Date: Wed, 29 Apr 2020 20:01:17 +0200

Calling vc-diff does not work in indirect buffers. If the base buffer
visits a file under version control, I expect it to behave as if
called from the base buffer.

The attached patch is a possible fix in that direction. I don't know
if other commands in vc should have the same fix, should that kind of
patch be applied.

Reproduction steps:
===============
run emacs -Q
open any file-under-version-control
M-x clone-indirect-buffer
In the new buffer, run vc-diff fails with `vc-deduce-fileset: Buffer
[...] is not associated with a file`

Details about the machine:
====================
Configured using:
 'configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install -C 'CFLAGS=-O2 -static -g3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp65001

Major mode: Messages

Minor modes in effect:
  global-subword-mode: t
  subword-mode: t
  save-place-mode: t
  minibuffer-depth-indicate-mode: t
  global-undo-tree-mode: t
  recentf-mode: t
  show-paren-mode: t
  global-auto-revert-mode: t
  savehist-mode: t
  delete-selection-mode: t
  override-global-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  global-visual-line-mode: t
  visual-line-mode: t
  transient-mark-mode: t

Load-path shadows:
~/.emacs.d/swiper/elpa hides ~/.emacs.d/lispy/elpa

Features:
(shadow sort mail-extr emacsbug message rmc puny format-spec rfc822 mml
mml-sec epa epg epg-config gnus-util rmail rmail-loaddefs time-date
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils bookmark text-property-search pp smerge-mode tabify
multiple-cursors-core rect eieio-opt speedbar sb-image ezimage dframe
counsel xdg dired dired-loaddefs apropos go-mode url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap find-file ffap compile cl-print debug cus-start
cus-load diff-hl face-remap vc-hg vc-dir vc-bzr vc-src vc-sccs vc-svn
vc-cvs vc-rcs ewoc vc vc-dispatcher vc-git diff-mode lispy swiper
lispy-inline noutline outline etags fileloop generator edebug backtrace
help-fns radix-tree lispy-tags mode-local find-func rainbow-delimiters
hl-todo pcase my-color-theme init my-init highlight-symbol thingatpt
cap-words superword subword saveplace ace-link mb-depth hl-line battery
undo-tree diff avy rx ivy-hydra ivy-xref ivy colir color ivy-overlay
xref project recentf tree-widget wid-edit hydra lv hippie-exp comint
ansi-color ring key-chord benchmark-init-modes paren elec-pair
autorevert filenotify savehist delsel dabbrev cl-extra help-mode edmacro
kmacro diminish cl use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core derived benchmark-init advice info package easymenu
browse-url url-handlers url-parse auth-source cl-seq eieio eieio-core
cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc
electric uniquify ediff-hook vc-hooks lisp-float-type mwheel dos-w32
ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core term/tty-colors frame
minibuffer cl-generic cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite charscript charprop case-table epa-hook jka-cmpr-hook help
simple abbrev obarray cl-preloaded nadvice loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
threads w32notify w32 lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 311030 114283)
 (symbols 48 21138 1)
 (strings 32 60774 2776)
 (string-bytes 1 1941284)
 (vectors 16 26613)
 (vector-slots 8 306017 10984)
 (floats 8 293 480)
 (intervals 56 3804 12)
 (buffers 1000 24))