branch: elpa/ebuild-mode
commit e3c4e820369c6426ffef0ff40d7fbe773ae3e913
Author: Ulrich Müller <[email protected]>
Commit: Ulrich Müller <[email protected]>
Add workaround for XEmacs font-lock
* ebuild-mode.el (ebuild-mode-add-font-lock): Fix initial
fontification in XEmacs.
Signed-off-by: Ulrich Müller <[email protected]>
---
ChangeLog | 3 +++
ebuild-mode.el | 12 +++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index ae43f99465..bf964e4a2b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2026-10-21 Ulrich Müller <[email protected]>
+ * ebuild-mode.el (ebuild-mode-add-font-lock): Fix initial
+ fontification in XEmacs.
+
* ebuild-mode.el (ebuild-mode-add-font-lock, ebuild-mode-hook):
* gentoo-newsitem-mode.el (gentoo-newsitem-add-font-lock)
(gentoo-newsitem-mode-hook):
diff --git a/ebuild-mode.el b/ebuild-mode.el
index 6b69bfcb4f..dde8966dda 100644
--- a/ebuild-mode.el
+++ b/ebuild-mode.el
@@ -450,7 +450,17 @@ of the elements."
(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))
+ (static-if (featurep 'xemacs)
+ ;; *** HACK *** XEmacs calls font-lock-fontify-buffer from
+ ;; font-lock-add-keywords *before* adding the new keywords.
+ ;; Disable the fontification function while adding and call
+ ;; it explicitly afterwards.
+ (progn
+ (let ((font-lock-fontify-buffer-function #'ignore))
+ (font-lock-add-keywords nil ebuild-mode-font-lock-keywords))
+ (and font-lock-mode font-lock-auto-fontify
+ (font-lock-fontify-buffer)))
+ (font-lock-add-keywords nil ebuild-mode-font-lock-keywords)))
(add-hook 'ebuild-mode-hook #'ebuild-mode-add-font-lock)