Bug #718

Emacs ruby-mode does not show comment #@var correctly

Added by Thomas Leitner over 5 years ago. Updated over 1 year ago.

Assignee:Yukihiro Matsumoto
Target version:-
ruby -v:N/A


Normal comments are shown correctly, ie. correctly colored. However, when commenting an instance variable without a
leading space, the color of the comment is the same as the color of an uncommented instance variable.

To reproduce, type the following in Emacs in a buffer with ruby-mode:

# this does work
# @var this does also work (shown in comment color)
#@var this does not work (shown in instance variable color)


#1 Updated by Shyouhei Urabe about 5 years ago

  • Assignee set to Yukihiro Matsumoto



#2 Updated by m . over 4 years ago

This is because #@ and #$ are not always comments. An example:

  $ ruby -e '$f = "world"; puts "hello #$f"'
  # => hello world

This also applies to class variables.

The mode could be changed to make sure that it parses #@/#$ as a comment only if it's not inside a string (I don't know about any other edge cases like the one noted above).

#3 Updated by Shyouhei Urabe over 3 years ago

  • Status changed from Open to Assigned
  • ruby -v set to N/A



#4 Updated by Dmitry Gutov over 1 year ago

Fixed in Emacs, to be released in 24.3.

Also available in: Atom PDF