[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28852: make revert-buffer ('g') in VC diff buffers keep point
From: |
Juri Linkov |
Subject: |
bug#28852: make revert-buffer ('g') in VC diff buffers keep point |
Date: |
Sat, 29 Jan 2022 20:48:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) |
>> This will restore point to the same point it was before... but not to
>> "where it was", necessarily, I think?
>
> I was confused about how these functions worked. I've respun the patch
> for Emacs 29, and it seem to work very well, so I've now pushed it.
This doesn't work with such customization:
(add-hook 'diff-mode-hook 'rename-uniquely)
because this change assumes that the current buffer is always "*vc-diff*"
whereas the reverted buffer can be "*vc-diff*<2>".
Isn't the reverted buffer always current during revert-buffer command?
If this assumption is correct, how about his fix?
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 0096a5fcb3..1671f2f860 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1798,10 +1798,9 @@ vc-diff-internal
(coding-system-for-read
(if files (vc-coding-system-for-diff (car files)) 'undecided))
(orig-diff-buffer-clone
- (if (and (get-buffer buffer) revert-buffer-in-progress-p)
- (with-current-buffer buffer
- (clone-buffer
- (generate-new-buffer-name " *vc-diff-clone*") nil)))))
+ (if revert-buffer-in-progress-p
+ (clone-buffer
+ (generate-new-buffer-name " *vc-diff-clone*") nil))))
;; On MS-Windows and MS-DOS, Diff is likely to produce DOS-style
;; EOLs, which will look ugly if (car files) happens to have Unix
;; EOLs.
--