summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2024-09-30 18:24:23 +0200
committerUlrich Müller <ulm@gentoo.org>2024-10-02 23:00:39 +0200
commitac8df7a2306eefbc1622dfac1b272f60c327a36b (patch)
treea5da32c580e62ca1c209ef634e731b4bbf384c25
parentShorten some function names in tests (diff)
downloadebuild-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--ChangeLog5
-rw-r--r--gentoo-newsitem-mode.el8
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index e9ac90f..ef0e8c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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