File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -2561,6 +2561,18 @@ Fontification needs to include this whole string or none of it.
2561
2561
)
2562
2562
)
2563
2563
2564
+ (ert-deftest rust-test-revert-hook-preserves-point ()
2565
+ (with-temp-buffer
2566
+ ; ; Insert some code, and put point in the middle.
2567
+ (insert " fn foo() {}\n " )
2568
+ (insert " fn bar() {}\n " )
2569
+ (insert " fn baz() {}\n " )
2570
+ (goto-char (point-min ))
2571
+ (forward-line 1 )
2572
+ (let ((initial-point (point )))
2573
+ (rust--after-revert-hook)
2574
+ (should (equal initial-point (point ))))))
2575
+
2564
2576
; ; If electric-pair-mode is available, load it and run the tests that use it. If not,
2565
2577
; ; no error--the tests will be skipped.
2566
2578
(require 'elec-pair nil t )
Original file line number Diff line number Diff line change @@ -1365,9 +1365,10 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
1365
1365
; ; to use `font-lock-ensure' , which doesn't exist in Emacs 24 and earlier.
1366
1366
; ; If it's not available, fall back to calling `font-lock-fontify-region'
1367
1367
; ; on the whole buffer.
1368
- (if (fboundp 'font-lock-ensure )
1369
- (font-lock-ensure )
1370
- (font-lock-fontify-region (point-min ) (point-max ))))
1368
+ (save-excursion
1369
+ (if (fboundp 'font-lock-ensure )
1370
+ (font-lock-ensure )
1371
+ (font-lock-fontify-region (point-min ) (point-max )))))
1371
1372
1372
1373
(defun rust--before-save-hook ()
1373
1374
(when rust-format-on-save (rust-format-buffer)))
You can’t perform that action at this time.
0 commit comments