GNU bug report logs - #21638
25.0.50; font-lock for CSS variables

Previous Next

Package: emacs;

Reported by: Tom Tromey <tom <at> tromey.com>

Date: Tue, 6 Oct 2015 17:59:01 UTC

Severity: minor

Found in version 25.0.50

Done: Simen Heggestøyl <simenheg <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 21638 <at> debbugs.gnu.org (full text, mbox):

From: Simen Heggestøyl <simenheg <at> gmail.com>
To: Tom Tromey <tom <at> tromey.com>
Cc: 21638 <at> debbugs.gnu.org, monnier <at> iro.umontreal.ca
Subject: Re: bug#21638: 25.0.50; font-lock for CSS variables
Date: Tue, 06 Oct 2015 21:24:53 +0200
Tom Tromey <tom <at> tromey.com> 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




This bug report was last modified 9 years and 231 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.