GNU bug report logs - #10786
24.0.93; ruby-mode improperly handles symbols with keyword names in JS-style hashes

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Sat, 11 Feb 2012 00:33:02 UTC

Severity: minor

Tags: patch

Found in version 24.0.93

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: 10786 <at> debbugs.gnu.org
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
[Message part 1 (text/plain, inline)]
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.

[ruby-keyword-symbols-patch.diff (text/plain, attachment)]

This bug report was last modified 13 years and 60 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.