Basically, I am trying to syntax to highlight the following coffeescript code snippet the way I want it. An explanation of the syntax of coffeescript functions can be found here .
nameHere = (tstamp, moo, boo) -> ...
The names tstamp, moo, and boo must be pink (and nothing else, not commas, not brackets) because they are parameters for the lambda function.
highOrderFun ((x) -> x * x) someList
Here is the first x, which is the parameter. Parameters can have default arguments:
class Foo meth: (msg = "Hello", bar = "foo") -> ....
The default arguments can be the variables themselves:
defColor = "red" print = (msg, color = defColor) -> ...
The msg and color values ββabove should be highlighted, but not defColor . An even more complicated case are functions with default arguments, which themselves are functions. I think emacs fonts are hard to select for correcting fonts, but I turn it on anyway:
funTakingFuns = (f1 = ((a, b) -> a*b), f2 = ((c, d) -> c/d)) -> ...
This seems rather difficult to achieve in emacs because you want the highlight to be context sensitive. I read the font locking documentation but couldn't figure it out.
I would appreciate it if someone could show me what to set font-lock-defaults so that the syntax displays what I want.
Update . Display more syntactic coffeescript examples.