diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2016-07-21 11:18:37 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-21 11:18:37 -0400 |
| commit | b3b0f780b1872951874b2ed05eb476ef6e980c09 (patch) | |
| tree | 355eeab2475c8160a1185cd539a658592b0d24d0 | |
| parent | 0cf2bc30ec29ad215242b617748c9fa1aa91c407 (diff) | |
| parent | 620d7182e67793d6c8f81dab70385c652d1ccf62 (diff) | |
| download | rust-mode-b3b0f780b1872951874b2ed05eb476ef6e980c09.tar.gz | |
Merge pull request #161 from Fanael/master
Fix #160
| -rw-r--r-- | rust-mode.el | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/rust-mode.el b/rust-mode.el index 16aaa6d..164c95b 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -1359,13 +1359,13 @@ This is written mainly to be used as `end-of-defun-function' for Rust." ;; Issue #104: When reverting the buffer, make sure all fontification is redone ;; so that we don't end up missing a non-angle-bracket '<' or '>' character. (defun rust--after-revert-hook () - (let - ;; Newer emacs versions (25 and later) make `font-lock-fontify-buffer' - ;; interactive-only, and want lisp code to call `font-lock-flush' or - ;; `font-lock-ensure'. But those don't exist in emacs 24 and earlier. - ((font-lock-ensure-fn (if (fboundp 'font-lock-ensure) 'font-lock-ensure 'font-lock-fontify-buffer))) - (funcall font-lock-ensure-fn)) - ) + ;; In Emacs 25 and later, the preferred method to force fontification is + ;; 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)))) (defun rust--before-save-hook () (when rust-format-on-save (rust-format-buffer))) |
