GNU bug report logs -
#16610
24.3.50; [ruby-mode] Variables named as built-in functions font-locked incorrectly
Previous Next
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
Message #17 received at 16610 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Saturday, February 1, 2014 at 6:29 PM, Dmitry Gutov wrote:
> 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).
>
>
I’d say that the second option is better, since it won’t cause false positives.
This would also take care of an annoying bit regarding the `p` built-in - each time you start
typing something that starts with “p" the “p” briefly gets font-locked as built-in, before the following letter is inserted.
[Message part 2 (text/html, inline)]
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.