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: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Dmitry Gutov <dgutov <at> yandex.ru>
Subject: bug#10786: closed (Re: bug#10786: 24.0.93; ruby-mode improperly
 handles symbols with keyword names in JS-style hashes)
Date: Wed, 21 Mar 2012 19:05:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#10786: 24.0.93; ruby-mode improperly handles symbols with keyword names in JS-style hashes

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 10786 <at> debbugs.gnu.org.

-- 
10786: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10786
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 10786-done <at> debbugs.gnu.org
Subject: Re: bug#10786: 24.0.93;
	ruby-mode improperly handles symbols with keyword names in JS-style
	hashes
Date: Wed, 21 Mar 2012 14:33:28 -0400
Thanks, installed,


        Stefan

[Message part 3 (message/rfc822, inline)]
From: Dmitry Gutov <dgutov <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: 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 4 (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.