diff options
author | Ulrich Müller <ulm@gentoo.org> | 2024-09-30 18:24:23 +0200 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2024-10-02 23:00:39 +0200 |
commit | ac8df7a2306eefbc1622dfac1b272f60c327a36b (patch) | |
tree | a5da32c580e62ca1c209ef634e731b4bbf384c25 | |
parent | Shorten some function names in tests (diff) | |
download | ebuild-mode-ac8df7a2306eefbc1622dfac1b272f60c327a36b.tar.gz ebuild-mode-ac8df7a2306eefbc1622dfac1b272f60c327a36b.tar.bz2 ebuild-mode-ac8df7a2306eefbc1622dfac1b272f60c327a36b.zip |
Set font-lock keywords for gentoo-newsitem-mode in the mode hook
* gentoo-newsitem-mode.el (gentoo-newsitem-mode): Don't set
font-lock-defaults.
(gentoo-newsitem-add-font-lock): New function.
(gentoo-newsitem-mode-hook): Add it to the mode hook.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | gentoo-newsitem-mode.el | 8 |
2 files changed, 11 insertions, 2 deletions
@@ -1,5 +1,10 @@ 2024-09-30 Ulrich Müller <ulm@gentoo.org> + * gentoo-newsitem-mode.el (gentoo-newsitem-mode): Don't set + font-lock-defaults. + (gentoo-newsitem-add-font-lock): New function. + (gentoo-newsitem-mode-hook): Add it to the mode hook. + * test/gentoo-newsitem-mode-tests.el (gentoo-newsitem-test-input) (gentoo-newsitem-test-font-lock, gentoo-newsitem-test-skeleton) (gentoo-newsitem-test-keybindings): Shorten names. diff --git a/gentoo-newsitem-mode.el b/gentoo-newsitem-mode.el index 07ab15b..f356708 100644 --- a/gentoo-newsitem-mode.el +++ b/gentoo-newsitem-mode.el @@ -50,12 +50,16 @@ ;;;###autoload (define-derived-mode gentoo-newsitem-mode text-mode "Newsitem" "Major mode for Gentoo GLEP 42 news items." - (make-local-variable 'font-lock-defaults) (if (featurep 'xemacs) (easy-menu-add gentoo-newsitem-mode-menu)) - (setq font-lock-defaults '(gentoo-newsitem-font-lock-keywords t)) (setq fill-column 72)) +(defun gentoo-newsitem-add-font-lock () + "Add `gentoo-newsitem-mode' font-lock keywords for the current buffer." + (font-lock-add-keywords nil gentoo-newsitem-font-lock-keywords)) + +(add-hook 'gentoo-newsitem-mode-hook #'gentoo-newsitem-add-font-lock) + (define-skeleton gentoo-newsitem-insert-skeleton "Insert a skeleton for a Gentoo GLEP 42 news item." nil |