Skip to content

Commit

Permalink
Rm extra indirection by making (color-identifiers:refontify) an alias
Browse files Browse the repository at this point in the history
For Emacs 25.1 and higher that makes `(color-identifiers:refontify)`
an alias to `(font-lock-flush)`. `(color-identifiers:refontify)` always
was just a wrapper, so no functional change is intended besides
removing the unnecessary indirection.

I haven't found a way to just leave `(if (fboundp … (defalias …)`
expression at the top-level and not cause any byte-compilation errors,
so the solution required a little bit of hackery, but hopefully it
should be safe. At least tests are passing and I haven't found any
problems.
  • Loading branch information
Hi-Angel committed Oct 23, 2024
1 parent f1dd3fa commit c233df3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions color-identifiers-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -746,11 +746,11 @@ major mode, identifiers are saved to
;; `color-identifiers:get-declarations', which returns all identifiers
(color-identifiers:get-declarations)))

(defun color-identifiers:refontify ()
"Refontify the buffer using font-lock."
(if (fboundp 'font-lock-flush)
(font-lock-flush)
;; `font-lock-flush' didn't exist prior to Emacs 25.1
(if (fboundp 'font-lock-flush)
(defalias 'color-identifiers:refontify 'font-lock-flush)
(declare-function color-identifiers:refontify nil)
(defun color-identifiers:refontify ()
"Refontify the buffer using font-lock."
(with-no-warnings
(and font-lock-mode (font-lock-fontify-buffer)))))

Expand Down

0 comments on commit c233df3

Please sign in to comment.