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

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

[nongnu] elpa/rust-mode 4381a89 433/486: Fix scrolling after rustfmt. (#


From: ELPA Syncer
Subject: [nongnu] elpa/rust-mode 4381a89 433/486: Fix scrolling after rustfmt. (#351)
Date: Sat, 7 Aug 2021 09:26:09 -0400 (EDT)

branch: elpa/rust-mode
commit 4381a89f6827716c9203b2f9ff0953934c6f0b4b
Author: Nathan Moreau <nathan.moreau@m4x.org>
Commit: GitHub <noreply@github.com>

    Fix scrolling after rustfmt. (#351)
    
    Co-authored-by: apiraino <apiraino@users.noreply.github.com>
---
 rust-mode.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/rust-mode.el b/rust-mode.el
index 3d50c2e..84a9355 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1569,7 +1569,12 @@ Return the created process."
                          (rust--format-get-loc buffer point))
                    window-loc))))))
     (unwind-protect
-        (rust--format-call (current-buffer))
+        ;; save and restore window start position
+        ;; after reformatting
+        ;; to avoid the disturbing scrolling
+        (let ((w-start (window-start)))
+          (rust--format-call (current-buffer))
+          (set-window-start (selected-window) w-start))
       (dolist (loc buffer-loc)
         (let* ((buffer (pop loc))
                (pos (rust--format-get-pos buffer (pop loc))))



reply via email to

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