GNU bug report logs - #28852
make revert-buffer ('g') in VC diff buffers keep point

Previous Next

Package: emacs;

Reported by: charles <at> aurox.ch (Charles A. Roelli)

Date: Sun, 15 Oct 2017 19:08:01 UTC

Severity: wishlist

Merged with 337

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 28852 <at> debbugs.gnu.org, "Charles A. Roelli" <charles <at> aurox.ch>
Subject: bug#28852: make revert-buffer ('g') in VC diff buffers keep point
Date: Sat, 29 Jan 2022 20:48:36 +0200
>> 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.
-- 




This bug report was last modified 3 years and 109 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.