Skip to content

Commit b3b0f78

Browse files
authored
Merge pull request #161 from Fanael/master
Fix #160
2 parents 0cf2bc3 + 620d718 commit b3b0f78

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

rust-mode.el

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,13 +1359,13 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
13591359
;; Issue #104: When reverting the buffer, make sure all fontification is redone
13601360
;; so that we don't end up missing a non-angle-bracket '<' or '>' character.
13611361
(defun rust--after-revert-hook ()
1362-
(let
1363-
;; Newer emacs versions (25 and later) make `font-lock-fontify-buffer'
1364-
;; interactive-only, and want lisp code to call `font-lock-flush' or
1365-
;; `font-lock-ensure'. But those don't exist in emacs 24 and earlier.
1366-
((font-lock-ensure-fn (if (fboundp 'font-lock-ensure) 'font-lock-ensure 'font-lock-fontify-buffer)))
1367-
(funcall font-lock-ensure-fn))
1368-
)
1362+
;; In Emacs 25 and later, the preferred method to force fontification is
1363+
;; to use `font-lock-ensure', which doesn't exist in Emacs 24 and earlier.
1364+
;; If it's not available, fall back to calling `font-lock-fontify-region'
1365+
;; on the whole buffer.
1366+
(if (fboundp 'font-lock-ensure)
1367+
(font-lock-ensure)
1368+
(font-lock-fontify-region (point-min) (point-max))))
13691369

13701370
(defun rust--before-save-hook ()
13711371
(when rust-format-on-save (rust-format-buffer)))

0 commit comments

Comments
 (0)