Subject: bug#70383: Conf-mode[toml] badly set face property

From: Eli Zaretskii <[email-masked]>
Date: Mon, 15 Apr 2024 17:34:13 +0300

> Date: Sun, 14 Apr 2024 20:59:02 +0100
> Cc: [email-masked]
> From: Alastair Irving <[email-masked]>
> 
> > I cannot reproduce this here, neither in Emacs 29 nor in Emacs 30.
> > What version of the TOML grammar library are you using?
> I don't think it's using a TOML grammar library, just conf-mode bundled 
> with EMACS "The major mode is Conf[TOML] mode defined in conf-mode.el".  
> I think an extra newline was inserted in the TOML I pasted (in the 
> comment before the URL), it should be 4 lines total. I've attached the 
> exact file.

Thanks.  Does the patch below give good results (I don't have too many
conf files around to test it).

Stefan, does the fix look good to you?

diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
index 5e16360..8a201bd 100644
--- a/lisp/textmodes/conf-mode.el
+++ b/lisp/textmodes/conf-mode.el
@@ -180,7 +180,7 @@ conf-font-lock-keywords
      (1 'font-lock-variable-name-face)
      (2 'font-lock-constant-face nil t))
     ;; section { ... } (do this last because some assign ...{...)
-    ("^[ \t]*\\([^#=:\n]+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend))
+    ("^[ \t]*\\([^[#=:\n]+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend))
   "Keywords to highlight in Conf mode.")
 
 (defvar conf-javaprop-font-lock-keywords