jacott / Enhanced-Ruby-Mode

An enhanced ruby-mode for Emacs that uses Ripper in ruby 1.9.2 to highlight and indent the source code
Other
53 stars 64 forks source link

Custom keywords #12

Closed asok closed 12 years ago

asok commented 12 years ago

With ruby-mode I was able to do something like this: (font-lock-add-keywords 'ruby-mode '(("\\<\\(require_relative\\|require\\|include\\|extend\\)\\>" . font-lock-keyword-face)))

But not in erm. It looks like it is working just for a seconds - when I edit buffer the font color changes but just after a second it goes back to default.

Is it possible to add custom keywords in erm?

jacott commented 12 years ago

erm does not really use font-lock so font-lock-add-keywords will not work.

I have added a new custom variable ruby-extra-keywords. After changing it you need to call the erm-reset function

I hope this suites your needs

Geoff

asok commented 12 years ago

Thanks a lot. Just a quick question: is there any way to set extra keywords per buffer (not globally). I was thinking about adding extra keywords to buffers with rspec-mode enabled.

jacott commented 12 years ago

Done. See doc on ruby-extra-keywords for details