Subject: Re: bug#21638: 25.0.50; font-lock for CSS variables

From: Simen Heggestøyl <[email-masked]>
Date: Tue, 06 Oct 2015 21:24:53 +0200

Tom Tromey <[email-masked]> writes:
> Right now CSS mode doesn't treat CSS variable definitions as
> properties.  I think it should.
>
> Here's the patch that worked for me:
>
> [...]
>
> Tom

Hi Tom!

Good idea. The patch seems to do the job, but it also has the side
effect that '---foo', '----foo' and so on are recognized as
properties.

Putting it instead at the start of 'css-nmstart-re' seems to fix that:

diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 5f4eebd..3e84b43 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -215,7 +215,7 @@
 (defconst css-escapes-re
   "\\\\\\(?:[^\000-\037\177]\\|[0-9a-fA-F]+[ \n\t\r\f]?\\)")
 (defconst css-nmchar-re (concat "\\(?:[-[:alnum:]]\\|" css-escapes-re "\\)"))
-(defconst css-nmstart-re (concat "\\(?:[[:alpha:]]\\|" css-escapes-re "\\)"))
+(defconst css-nmstart-re (concat "\\(?:--\\)?\\(?:[[:alpha:]]\\|" css-escapes-re "\\)"))
 (defconst css-ident-re ;; (concat css-nmstart-re css-nmchar-re "*")
   ;; Apparently, "at rules" names can start with a dash, e.g. @-moz-keyframes.
   (concat css-nmchar-re "+"))

Though I'm unsure what 'css-nmstart-re' is intended to contain, since
it's missing a docstring. Maybe Stefan knows?

-- Simen