From e452995b8ccd388f4be13a11443cffe3cdcd0619 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Tue, 2 Aug 2016 22:29:40 -0400 Subject: rust--after-revert-hook should preserve point position. Otherwise, rust-format-buffer always moves point to the end of the buffer. --- rust-mode.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'rust-mode.el') diff --git a/rust-mode.el b/rust-mode.el index 6259b48..1fbc3e8 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -1365,9 +1365,10 @@ This is written mainly to be used as `end-of-defun-function' for Rust." ;; to use `font-lock-ensure', which doesn't exist in Emacs 24 and earlier. ;; If it's not available, fall back to calling `font-lock-fontify-region' ;; on the whole buffer. - (if (fboundp 'font-lock-ensure) - (font-lock-ensure) - (font-lock-fontify-region (point-min) (point-max)))) + (save-excursion + (if (fboundp 'font-lock-ensure) + (font-lock-ensure) + (font-lock-fontify-region (point-min) (point-max))))) (defun rust--before-save-hook () (when rust-format-on-save (rust-format-buffer))) -- cgit v1.2.3