diff --git a/parinfer-rust-mode.el b/parinfer-rust-mode.el index a4526a8..e521805 100644 --- a/parinfer-rust-mode.el +++ b/parinfer-rust-mode.el @@ -614,10 +614,13 @@ CHANGES." (switch-to-buffer current) (if (eq parinfer-rust-buffer-replace-strategy 'fast) - (progn + (let ((window-start-pos (window-start))) (delete-region (point-min) (point-max)) - (insert-buffer-substring new-buf)) + (insert-buffer-substring new-buf) + (when (not (= window-start-pos + (window-start))) + (set-window-start (selected-window) window-start-pos))) (replace-buffer-contents new-buf 1)) (kill-buffer new-buf) (undo-amalgamate-change-group change-group)))))