bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#10786: 24.0.93; ruby-mode improperly handles symbols with keyword na


From: Dmitry Gutov
Subject: bug#10786: 24.0.93; ruby-mode improperly handles symbols with keyword names in JS-style hashes
Date: Sat, 11 Feb 2012 04:27:33 +0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1

Ruby 1.9 introduced the new syntax for hashes:

{key1: value1, key2: value2}

which is synonymous to {:key1 => value1, :key2 => value2}

The latest ruby-mode highlights the keywords in the new-style hashes properly, but fails to account for the case when the symbol's name is an otherwise reserved keyword. Examples:

link_to("root", root_path, class: "pink")

before_filter :do_stuff, if: :not_busy?

announce("The end is near!", end: "2012-12-31")

In all examples, the symbol (class, if, end) is being highlighted as a reserved keyword, and the indentation becomes broken on all lines below it.

There's a similar bug on the Ruby bug tracker:
http://bugs.ruby-lang.org/issues/5140

See attachment for the patch.

Attachment: ruby-keyword-symbols-patch.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]