bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20859: 25.0.50; css-mode: Comments within URIs


From: Stefan Monnier
Subject: bug#20859: 25.0.50; css-mode: Comments within URIs
Date: Sun, 21 Jun 2015 21:13:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> However, css-mode doesn't currently interpret the stuff between the
> parenthesis in the quote-less form as strings. This means that URIs
> containing /* (or // in scss-mode, which is more common for URIs) will
> be interpreted as comment starters by Emacs.

Indeed.

> I attempted to fix this by setting syntax-propertize-function to the
> following:
>  (syntax-propertize-rules
>     ("url\\(\(\\)[[:space:]]*[[:graph:]]*[[:space:]]*\\(\)\\)"
              ^^                                          ^^
[ Side note: these are the same as the unquoted parens (IOW the
  backslash there are ineffective, which is actually fine because we don't
  need them).  ]

There's also a real problem: how should we treat url(foo)bar) ?

>      (1 "|") (2 "|")))
> This almost solves the problem, but with the quirk that "(" and ")"
> are interpreted as part of the string.

Just like single quotes and double quotes are usually highlighted as
part of the string.  IOW, I think it's OK to highlight the parens as
part of the string, tho only when the argument inside the parens is not
itself wrapped in '...' or "...".

So we should use a regexp that only matches when the contents of the
parens is not quoted.

> Would it be possible to assign string syntax to the stuff between the
> two parenthesis without having any visible string delimiters? I'm
> thankful for any hints for getting closer to a solution!

If you really care about it you could add a font-lock-keyword which
matches "url(...)" and overrides the face on the open and close parens.


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]