Emacs ruby-mode problems

Hi there,

I’m using Emacs for editing since a few months now and enjoy it
mostly. However, there’s one thing that continues to annoy me: The
default ruby-mode lacks some syntax highlighting and isn’t able to
cope with extended symbol literals (or however these are called, see
below). To demonstrate the problem, the following code doesn’t get the
highlighting I expect:

···

====================================================================
regex = %r<I am a Regular Expression> # Should be highlighted as
                                       # regular expression, breaks
                                       # indentation

symbol = %s|This is a symbol| # Should be highlighted as a
                                       # symbol as well

str = %q{This is a string} # Should be highlighted as a
                                       # string

str = %{This is a string} # Should be highlighted as a
                                       # string

ary = %w[item1 item2 item3] # Could be highlighted as a
                                       # string

symbol = :"this is a symbol" # Should be highlighted as a
                                       # symbol (not string), sometimes
                                       # breaks indentation

You see, I’m mainly talking about the percent % literals. Is there
anything one can do about this besides digging deep into the code for
ruby-mode?

Valete,
Marvin

PS: Please, don’t issue "vim is better" statements. This is just an
Emacs-related question and that’s it.

I’m using Emacs for editing since a few months now and enjoy it
mostly. However, there’s one thing that continues to annoy me: The
default ruby-mode lacks some syntax highlighting and isn’t able to
cope with extended symbol literals (or however these are called, see
below). To demonstrate the problem, the following code doesn’t get the
highlighting I expect:

====================================================================
regex = %r<I am a Regular Expression> # Should be highlighted as
                                      # regular expression, breaks
                                      # indentation

symbol = %s|This is a symbol| # Should be highlighted as a
                                      # symbol as well

str = %q{This is a string} # Should be highlighted as a
                                      # string

str = %{This is a string} # Should be highlighted as a
                                      # string

ary = %w[item1 item2 item3] # Could be highlighted as a
                                      # string

This seems wrong.

symbol = :"this is a symbol" # Should be highlighted as a
                                      # symbol (not string), sometimes
                                      # breaks indentation

As an unrelated aside, I'd recommend you look at align-regexp. I loves it.

You see, I’m mainly talking about the percent % literals. Is there
anything one can do about this besides digging deep into the code for
ruby-mode?

Matz is the author/maintainer of ruby-mode.el. Report a bug on redmine.

···

On Nov 24, 2011, at 12:42 , Quintus wrote:

ary = %w[item1 item2 item3] # Could be highlighted as
a # string

This seems wrong.

This was just a suggestion as I don’t have an idea as what else it
should be highlighted.

As an unrelated aside, I'd recommend you look at align-regexp. I
loves it.

Me too^^. Maybe my email client screw up the indentation? However,
this isn’t important for the topic...

You see, I’m mainly talking about the percent % literals. Is
there anything one can do about this besides digging deep into
the code for ruby-mode?

Matz is the author/maintainer of ruby-mode.el. Report a bug on
redmine.

Vale,
Marvin

···

On 24.11.2011 23:38, Ryan Davis wrote: