From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bozhidar Batsov Newsgroups: gmane.emacs.bugs Subject: bug#16610: 24.3.50; [ruby-mode] Variables named as built-in functions font-locked incorrectly Date: Sat, 1 Feb 2014 18:47:43 +0200 Message-ID: <2461E4B67652483FB1E4176FAFD3BC5F@gmail.com> References: <87eh3moo7e.fsf@yandex.ru> <6BA278AF18054533AC980400A5F5FD54@gmail.com> <52ED20D6.5000300@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="52ed252f_116ae494_c8" X-Trace: ger.gmane.org 1391273295 23625 80.91.229.3 (1 Feb 2014 16:48:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 1 Feb 2014 16:48:15 +0000 (UTC) Cc: 16610@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Feb 01 17:48:22 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W9djx-0002uM-VT for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Feb 2014 17:48:22 +0100 Original-Received: from localhost ([::1]:38309 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9djx-0003yb-Eu for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Feb 2014 11:48:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9djm-0003yD-J0 for bug-gnu-emacs@gnu.org; Sat, 01 Feb 2014 11:48:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W9djf-0004AG-8i for bug-gnu-emacs@gnu.org; Sat, 01 Feb 2014 11:48:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59496) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W9djf-0004AC-52 for bug-gnu-emacs@gnu.org; Sat, 01 Feb 2014 11:48:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W9dje-0008UR-4y for bug-gnu-emacs@gnu.org; Sat, 01 Feb 2014 11:48:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Bozhidar Batsov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Feb 2014 16:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16610 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16610-submit@debbugs.gnu.org id=B16610.139127327132619 (code B ref 16610); Sat, 01 Feb 2014 16:48:02 +0000 Original-Received: (at 16610) by debbugs.gnu.org; 1 Feb 2014 16:47:51 +0000 Original-Received: from localhost ([127.0.0.1]:45282 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W9djS-0008U2-T8 for submit@debbugs.gnu.org; Sat, 01 Feb 2014 11:47:51 -0500 Original-Received: from mail-ea0-f179.google.com ([209.85.215.179]:51652) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W9djR-0008Tu-0Y for 16610@debbugs.gnu.org; Sat, 01 Feb 2014 11:47:49 -0500 Original-Received: by mail-ea0-f179.google.com with SMTP id q10so2423922ead.24 for <16610@debbugs.gnu.org>; Sat, 01 Feb 2014 08:47:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-type; bh=wEYGhdBbyyQ8Jyt61krynO7x1RfnUvREnEZKy+TZ/OQ=; b=sDkhR74/N/BnpRwounCEZB+v4DYfu3zqDHSk+cqePitGGrB7pwKYce5M90uEUi5gWi ceN0iDOVJadKizDvLmKxI2HT8KauSTRz7GjzbQfj2Frge8Ha+Y/A6BL0b2pHSgaLu2lR bTDvSBsIX9vkWgGb1MzGScUJdMEB1SPF1kj0xM5G0TPBCBNCjyiV6PQ5s6/cVD/WUKl2 5xYE7kATlfFRahYmO7Q/KNfmfmJSAmLQgGm2Ca21evSmvj41OpQCiG4VA5WSg5ZlG98F xVse/lkVGHfwpKbQZpWebq8/MFf/YyW/Ew9j/hvboOuD2QvT3foFGYlFWsgX27dyGp5v 9QHg== X-Received: by 10.14.127.72 with SMTP id c48mr31981403eei.16.1391273268210; Sat, 01 Feb 2014 08:47:48 -0800 (PST) Original-Received: from [10.0.1.8] (93-152-182-45.ddns.onlinedirect.bg. [93.152.182.45]) by mx.google.com with ESMTPSA id d9sm25098529eei.9.2014.02.01.08.47.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 01 Feb 2014 08:47:47 -0800 (PST) In-Reply-To: <52ED20D6.5000300@yandex.ru> X-Mailer: sparrow 1.6.4 (build 1178) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:84400 Archived-At: --52ed252f_116ae494_c8 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Saturday, =46ebruary 1, 2014 at 6:29 PM, Dmitry Gutov wrote: > On 01.02.2014 17:31, Bozhidar Batsov wrote: > > Variables can=E2=80=99t end with =3F, so > > block=5Fgiven=3F is always clear. Same goes for exit=21. Pretty sure = no one > > will ever name a var =5F=5Fxxx=5F=5F. > > =20 > =20 > =20 > Good points. > =20 > > =60binding=60 & =60caller=60 seem the most likely > > names in the list to cause a problem like =60format=60, since they=E2= =80=99d be good > > variable names (at least in code making use of metaprogramming). > > =20 > =20 > =20 > Still not very likely, though (e.g. compared to =60format=60, which is = in =20 > every other Rails tutorial). And anyone doing metaprogramming should be= =20 > aware of these two, and would probably name their vars differently. > =20 > I have a patch ready, but here's what I'm not sure about: if the =20 > built-in method that requires arguments is followed by (maybe whitespac= e =20 > and) newline, do we highlight it=3F > =20 > If yes, we'll have false positives when a local variable with that name= =20 > is at a line by itself, maybe on the last line of a method, so that its= =20 > value is returned. > =20 > If no, any such built-in won't be highlighted until the user types in =20 > the first argument, which is also suboptimal (if I made a typo, I'll =20 > have to go back a longer distance). > =20 > =20 I=E2=80=99d say that the second option is better, since it won=E2=80=99t = cause false positives. =20 This would also take care of an annoying bit regarding the =60p=60 built-= in - each time you start typing something that starts with =E2=80=9Cp=22 the =E2=80=9Cp=E2=80=9D b= riefly gets font-locked as built-in, before the following letter is inser= ted. =20 --52ed252f_116ae494_c8 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
On Sa= turday, =46ebruary 1, 2014 at 6:29 PM, Dmitry Gutov wrote:
On 01.02.2014 17:31, Bozhidar Ba= tsov wrote:
Variables can=E2= =80=99t end with =3F, so
block=5Fgiven=3F is always clear. Same= goes for exit=21. Pretty sure no one
will ever name a var =5F=5F= xxx=5F=5F.

Good points.
=

=60binding=60 &= ; =60caller=60 seem the most likely
names in the list to cause = a problem like =60format=60, since they=E2=80=99d be good
varia= ble names (at least in code making use of metaprogramming).

Still not very likely, though (e.g. compar= ed to =60format=60, which is in
every other Rails tutorial). A= nd 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 whitespa= ce
and) newline, do we highlight it=3F

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, s= o 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).
=20 =20 =20 =20
=20
I=E2=80=99d say that = the second option is better, since it won=E2=80=99t cause false positives= .
This would als= o take care of an annoying bit regarding the =60p=60 built-in - each time= you start
typing someth= ing that starts with =E2=80=9Cp=22 the =E2=80=9Cp=E2=80=9D brie= fly gets font-locked as built-in, before the following letter is inserted= . 

--52ed252f_116ae494_c8--