diff options
author | Ulrich Müller <ulm@gentoo.org> | 2023-10-06 09:33:47 +0200 |
---|---|---|
committer | Ulrich Müller <ulm@gentoo.org> | 2023-10-06 09:33:47 +0200 |
commit | 27c72045128d9f4fb909aa36cd3d4a0104f5ee70 (patch) | |
tree | aba7ac066a978016a05f124194ce86386c16334f | |
parent | Update texinfo documentation (diff) | |
download | ebuild-mode-27c72045128d9f4fb909aa36cd3d4a0104f5ee70.tar.gz ebuild-mode-27c72045128d9f4fb909aa36cd3d4a0104f5ee70.tar.bz2 ebuild-mode-27c72045128d9f4fb909aa36cd3d4a0104f5ee70.zip |
Use named functions in hook variables
* ebuild-mode.el (ebuild-mode-add-font-lock): New function.
(ebuild-mode-hook): Add it, instead of an anonymous function.
* glep-mode.el (glep-mode-add-font-lock, glep-mode-hook): Ditto.
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ebuild-mode.el | 8 | ||||
-rw-r--r-- | glep-mode.el | 17 |
3 files changed, 20 insertions, 11 deletions
@@ -1,3 +1,9 @@ +2023-10-06 Ulrich Müller <ulm@gentoo.org> + + * ebuild-mode.el (ebuild-mode-add-font-lock): New function. + (ebuild-mode-hook): Add it, instead of an anonymous function. + * glep-mode.el (glep-mode-add-font-lock, glep-mode-hook): Ditto. + 2023-09-25 Ulrich Müller <ulm@gentoo.org> * ebuild-mode.texi (ebuild-mode): Document the diff --git a/ebuild-mode.el b/ebuild-mode.el index 9e014b4..80c0731 100644 --- a/ebuild-mode.el +++ b/ebuild-mode.el @@ -424,9 +424,11 @@ Compatibility function for XEmacs." (set (make-local-variable 'paragraph-separate) (concat paragraph-start "\\|^# @")))) -(add-hook 'ebuild-mode-hook - (lambda () (font-lock-add-keywords - nil ebuild-mode-font-lock-keywords))) +(defun ebuild-mode-add-font-lock () + "Add `ebuild-mode' font-lock keywords for the current buffer." + (font-lock-add-keywords nil ebuild-mode-font-lock-keywords)) + +(add-hook 'ebuild-mode-hook 'ebuild-mode-add-font-lock) ;;; Run ebuild command. diff --git a/glep-mode.el b/glep-mode.el index 9175c4e..d36cc76 100644 --- a/glep-mode.el +++ b/glep-mode.el @@ -96,14 +96,15 @@ For efficiency only. Unlimited if nil.") 'glep-mode-font-lock-extend-region t) (add-hook 'write-contents-functions 'glep-mode-before-save t t)) -(add-hook - 'glep-mode-hook - (lambda () - (font-lock-add-keywords - nil `((glep-mode-font-lock-match-delims - . ,font-lock-comment-delimiter-face) - (glep-mode-font-lock-match-preamble - . ,font-lock-keyword-face))))) +(defun glep-mode-add-font-lock () + "Add `glep-mode' font-lock keywords for the current buffer." + (font-lock-add-keywords + nil `((glep-mode-font-lock-match-delims + . ,font-lock-comment-delimiter-face) + (glep-mode-font-lock-match-preamble + . ,font-lock-keyword-face)))) + +(add-hook 'glep-mode-hook 'glep-mode-add-font-lock) (defun glep-mode-preamble-bounds () "Return list with begin and end of the preamble, or nil if none found." |