all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Bozhidar Batsov <bozhidar@batsov.com>
To: Dmitry Gutov <dgutov@yandex.ru>
Cc: 16610@debbugs.gnu.org
Subject: bug#16610: 24.3.50; [ruby-mode] Variables named as built-in functions font-locked incorrectly
Date: Sat, 1 Feb 2014 17:31:12 +0200	[thread overview]
Message-ID: <6BA278AF18054533AC980400A5F5FD54@gmail.com> (raw)
In-Reply-To: <87eh3moo7e.fsf@yandex.ru>

[-- Attachment #1: Type: text/plain, Size: 1402 bytes --]

On Saturday, February 1, 2014 at 5:19 PM, Dmitry Gutov wrote:
> Bozhidar Batsov <bozhidar@batsov.com (mailto:bozhidar@batsov.com)> writes:
>  
> > In the following snippet `format` is font-locked as the built-in
> > function, but it's actually a variable.
> >  
> > respond_to do |format|
> > format.json do
> > # ...
> > end
> > end
> >  
> > This problem obviously exists for all built-ins, but it's not a big
> > issue in general, since most of them don't have names that are likely to
> > be used as variable names. Not sure if we can have a simple solution for
> > this problem without a parser, though. I guess we can have a check if
> > the built-in methods have arguments (as most of them have).
> >  
>  
>  
> A lot of them don't, though (or have no required arguments): __callee__,
> __dir__, __method__, binding, caller, block_given?, exit, exit!, raise,
> (s)rand, readline(s), sleep.
>  
> Guess we can separate these, and for all others, check if they're
> followed by " *[]|,.)}]\\|$".
>  
>  

Separating the methods sounds reasonable. 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__. `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).  


[-- Attachment #2: Type: text/html, Size: 1992 bytes --]

  reply	other threads:[~2014-02-01 15:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-01  7:22 bug#16610: 24.3.50; [ruby-mode] Variables named as built-in functions font-locked incorrectly Bozhidar Batsov
2014-02-01 15:19 ` Dmitry Gutov
2014-02-01 15:31   ` Bozhidar Batsov [this message]
2014-02-01 16:29     ` Dmitry Gutov
2014-02-01 16:47       ` Bozhidar Batsov
2014-02-01 17:09         ` Dmitry Gutov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6BA278AF18054533AC980400A5F5FD54@gmail.com \
    --to=bozhidar@batsov.com \
    --cc=16610@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.