all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#40967: 27.0.50; vc-diff in indirect buffers
@ 2020-04-29 18:01 Nathan Moreau
  2020-04-29 18:13 ` Dmitry Gutov
  2020-10-15  8:08 ` Richard Copley
  0 siblings, 2 replies; 12+ messages in thread
From: Nathan Moreau @ 2020-04-29 18:01 UTC (permalink / raw)
  To: 40967

[-- Attachment #1: Type: text/plain, Size: 4609 bytes --]

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))

[-- Attachment #2: vc-diff-indirect-buffers.diff --]
[-- Type: application/octet-stream, Size: 763 bytes --]

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 132278e823..d1c339c5b5 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1874,9 +1874,10 @@ saving the buffer."
   (interactive (list current-prefix-arg t))
   (if historic
       (call-interactively 'vc-version-diff)
-    (when buffer-file-name (vc-buffer-sync not-urgent))
-    (vc-diff-internal t (vc-deduce-fileset t) nil nil
-		      (called-interactively-p 'interactive))))
+    (with-current-buffer (or (buffer-base-buffer) (current-buffer))
+      (when buffer-file-name (vc-buffer-sync not-urgent))
+      (vc-diff-internal t (vc-deduce-fileset t) nil nil
+                        (called-interactively-p 'interactive)))))
 
 ;;;###autoload
 (defun vc-diff-mergebase (_files rev1 rev2)

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-10-15  8:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-29 18:01 bug#40967: 27.0.50; vc-diff in indirect buffers Nathan Moreau
2020-04-29 18:13 ` Dmitry Gutov
2020-06-16 12:08   ` Phil Sainty
2020-06-16 22:37     ` Dmitry Gutov
2020-07-01  0:19       ` Nathan Moreau
2020-07-09 21:47         ` Nathan Moreau
2020-10-01 17:56           ` Lars Ingebrigtsen
2020-10-02  0:27             ` Nathan Moreau
2020-10-03 17:33               ` Lars Ingebrigtsen
2020-10-03 18:32                 ` Dmitry Gutov
2020-10-05  6:50                   ` Lars Ingebrigtsen
2020-10-15  8:08 ` Richard Copley

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.