sawa
sawa

Reputation: 168169

Commented string to fix emacs ruby mode highlighting

Sometimes, parsing done by text editors for syntax highlighting is not accurate. It often happens that introducing a heredoc in ruby-mode messes up syntax highlighting on emacs as in this question. I am having problem with such case:

<<_
  some here doc content
  ...
  last line of the intended heredoc
_
this_ruby_code_line_and_any_line_after_it_is_highlightened_as_part_of_heredoc

I do not expect a fix on emacs ruby-mode for this, but is there some kind of a commented string that I can generally put between the heredoc and the following Ruby code in order to reset the highlighting problem? When I have problems not with heredoc but with funky string literals (especially those including quotes), sometimes, putting a commented string like

#"'`

at the end of the line fixes the problem. Is there such thing to fix the problem for heredoc, and further, is there a string that can be used more generally?

Upvotes: 0

Views: 375

Answers (1)

Dmitry
Dmitry

Reputation: 3665

Works fine for me in an Emacs trunk build.

Try a more recent Emacs version (I'm quite certain that this works in the upcoming 24.3 version, but maybe in the current release, too) and/or make sure that you are using ruby-mode bundled with Emacs, not installed through ELPA, etc:

ELISP> (require 'which-func)
which-func
ELISP> (find-library-name "ruby-mode")
"/home/gutov/emacs-bzr/trunk/lisp/progmodes/ruby-mode.el"

Upvotes: 1

Related Questions