emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/hyperdrive 087bcf1a85 5/6: Change: (hyperdrive-handler-def


From: ELPA Syncer
Subject: [nongnu] elpa/hyperdrive 087bcf1a85 5/6: Change: (hyperdrive-handler-default) Restore point on revert-buffer
Date: Wed, 20 Sep 2023 00:59:40 -0400 (EDT)

branch: elpa/hyperdrive
commit 087bcf1a8505670d6923de1634394d1cad39c933
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>

    Change: (hyperdrive-handler-default) Restore point on revert-buffer
    
    If no buffer was previously visiting the file, then old-point will be 0.
---
 hyperdrive-lib.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 0ff4e565cb..a982ce7bf1 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -1150,14 +1150,15 @@ If then, then call THEN with no arguments.  Default 
handler."
               ;; same page (but ensure that reverting still works).
               (if (buffer-modified-p)
                   (hyperdrive-message "Buffer modified: %S" (current-buffer))
-                (with-silent-modifications
-                  (erase-buffer)
-                  (insert-buffer-substring response-buffer))
-                (setf buffer-undo-list nil
-                      buffer-read-only (or (not (hyperdrive-writablep 
hyperdrive)) version))
-                (set-buffer-modified-p nil)
-                (set-visited-file-modtime (current-time))
-                (goto-char (point-min)))
+                (let ((old-point (point)))
+                  (with-silent-modifications
+                    (erase-buffer)
+                    (insert-buffer-substring response-buffer))
+                  (setf buffer-undo-list nil
+                        buffer-read-only (or (not (hyperdrive-writablep 
hyperdrive)) version))
+                  (set-buffer-modified-p nil)
+                  (set-visited-file-modtime (current-time))
+                  (goto-char old-point)))
               ;; TODO: Option to defer showing buffer.
               ;; It seems that `pop-to-buffer' is moving point, even
               ;; though it shouldn't, so we call it here, before going



reply via email to

[Prev in Thread] Current Thread [Next in Thread]