summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rust-mode.el7
1 files changed, 6 insertions, 1 deletions
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))))