GNU bug report logs - #16610
24.3.50; [ruby-mode] Variables named as built-in functions font-locked incorrectly

Previous Next

Package: emacs;

Reported by: Bozhidar Batsov <bozhidar <at> batsov.com>

Date: Sat, 1 Feb 2014 07:24:02 UTC

Severity: normal

Found in version 24.3.50

Fixed in version 24.4

Done: Dmitry Gutov <dgutov <at> yandex.ru>

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: Bozhidar Batsov <bozhidar <at> batsov.com>
Cc: 16610 <at> debbugs.gnu.org
Subject: bug#16610: 24.3.50; [ruby-mode] Variables named as built-in functions font-locked incorrectly
Date: Sat, 01 Feb 2014 18:29:10 +0200
On 01.02.2014 17:31, Bozhidar Batsov wrote:
> Variables can’t end with ?, so
> block_given? is always clear. Same goes for exit!. Pretty sure no one
> will ever name a var __xxx__.

Good points.

> `binding` & `caller` seem the most likely
> names in the list to cause a problem like `format`, since they’d be good
> variable names (at least in code making use of metaprogramming).

Still not very likely, though (e.g. compared to `format`, which is in 
every other Rails tutorial). And anyone doing metaprogramming should be 
aware of these two, and would probably name their vars differently.

I have a patch ready, but here's what I'm not sure about: if the 
built-in method that requires arguments is followed by (maybe whitespace 
and) newline, do we highlight it?

If yes, we'll have false positives when a local variable with that name 
is at a line by itself, maybe on the last line of a method, so that its 
value is returned.

If no, any such built-in won't be highlighted until the user types in 
the first argument, which is also suboptimal (if I made a typo, I'll 
have to go back a longer distance).




This bug report was last modified 11 years and 112 days ago.

Previous Next


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