Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions cmake-font-lock.el
Original file line number Diff line number Diff line change
Expand Up @@ -1490,15 +1490,13 @@ To activate this every time a CMake file is opened, use the following:
;; This ensures that this package is enabled automatically when
;; installed as a package (when cmake-mode is installed).

;; Note: Personally, I dislike adding lambda expressions to hooks.
;; However, in this case it's required to ensure that this package
;; isn't loaded until it's actually used.

;;;###autoload
(add-hook 'change-major-mode-after-body-hook
(lambda ()
(when (apply #'derived-mode-p cmake-font-lock-modes)
(cmake-font-lock-activate))))
(progn
(defun cmake-font-lock-maybe-activate ()
"Call `cmake-font-lock-activate' in `cmake-font-lock-modes'."
(when (apply #'derived-mode-p cmake-font-lock-modes)
(cmake-font-lock-activate)))
(add-hook 'change-major-mode-after-body-hook #'cmake-font-lock-maybe-activate))


(defun cmake-font-lock-add-keywords (name keywords)
Expand Down