defunkt / coffee-mode

Emacs Major Mode for CoffeeScript
http://ozmm.org/posts/coffee_mode.html
574 stars 147 forks source link

@this highlighting #315

Closed gugiserman closed 9 years ago

gugiserman commented 9 years ago

Why isn't "@" highlighted as keyword in variables?

syohex commented 9 years ago

Could you show us screenshot or sample code ?

gugiserman commented 9 years ago

ubuntu 14.04, emacs 24.3, coffee-mode and monokai

screenshot from 2015-08-04 13 57 03

same code in WebStorm from intellij, using monokai as well: screenshot from 2015-08-04 13 59 00

syohex commented 9 years ago

I see.

Why isn't "@" highlighted as keyword in variables?

Sorry I don't understand. Original code implements such highlighting. However coffee-mode highlights @ same as Vim, SublimeText, Atom.io.

Vim

vim

SublimeText

sublimetext

Atom.io

atom.io

syohex commented 9 years ago

I suppose you can customize @ highlighting with following configuration.

(defface my/coffee-at-mark
  '((t (:foreground "green")))
  "my at mark")

(font-lock-add-keywords
 'coffee-mode
 '(("\\(@\\)\\([_[:word:]]+\\|\\<this\\)\\>"
    (1 'my/coffee-at-mark)
    (2 font-lock-variable-name-face))))

Screenshot is here.

my-own-atmark

gugiserman commented 9 years ago

@syohex thank you very much!!!!!