From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Iustin Pop Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] etags: Add a small list of interpretors for Python Date: Thu, 23 Dec 2010 15:13:44 +0100 Message-ID: <20101223141344.GB18711@google.com> References: <20100819153606.GO4157@google.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1293119428 18166 80.91.229.12 (23 Dec 2010 15:50:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 23 Dec 2010 15:50:28 +0000 (UTC) Cc: emacs-devel@gnu.org To: Francesco =?iso-8859-1?Q?Potort=EC?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 23 16:50:23 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PVnQt-0005y8-8w for ged-emacs-devel@m.gmane.org; Thu, 23 Dec 2010 16:50:23 +0100 Original-Received: from localhost ([127.0.0.1]:47538 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PVnQs-0002el-OO for ged-emacs-devel@m.gmane.org; Thu, 23 Dec 2010 10:50:22 -0500 Original-Received: from [140.186.70.92] (port=44131 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PVlvU-0005ug-F1 for emacs-devel@gnu.org; Thu, 23 Dec 2010 09:13:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PVlvT-0002Mg-7Q for emacs-devel@gnu.org; Thu, 23 Dec 2010 09:13:52 -0500 Original-Received: from smtp-out.google.com ([216.239.44.51]:16588) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PVlvT-0002MV-3S for emacs-devel@gnu.org; Thu, 23 Dec 2010 09:13:51 -0500 Original-Received: from wpaz33.hot.corp.google.com (wpaz33.hot.corp.google.com [172.24.198.97]) by smtp-out.google.com with ESMTP id oBNEDmPE028390 for ; Thu, 23 Dec 2010 06:13:48 -0800 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1293113628; bh=JDWCbC/SWY9PISVg9n65Zjq5kaA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Transfer-Encoding:In-Reply-To; b=ETdIahUU/vIKaF8/T86iVFtrUERBSOjKDKhlaufhOkxRCUBX3im8HH6KJFUhSL+V6 JylwtVicsFgQ/gX6kLFUQ== Original-Received: from wyi11 (wyi11.prod.google.com [10.241.227.11]) by wpaz33.hot.corp.google.com with ESMTP id oBNEDkKO027440 for ; Thu, 23 Dec 2010 06:13:47 -0800 Original-Received: by wyi11 with SMTP id 11so6234001wyi.24 for ; Thu, 23 Dec 2010 06:13:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=VXoEr1H5Ibu//LWbpZH6jv3shjLdHcpgXoZFEDGRnTQ=; b=Ptrm4NstH/kA3zlCGwfYNtM6Z+TjqaRQYWihMCAuzAp+gpAqWVklsNTq7ukW2Q8zG/ ZSm8ezAVe5adMJWTcmxg== DomainKey-Signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:user-agent; b=GCYiDm097tHjMISEeqKXfxTcJpKJZiJEUKotQGBcWrOkXl1wuaw37pm63mz7nUUbMc RP00GWP5Tkl4Bs3Yl7ig== Original-Received: by 10.227.143.18 with SMTP id s18mr5055049wbu.98.1293113626417; Thu, 23 Dec 2010 06:13:46 -0800 (PST) Original-Received: from google.com (rrr.zrh.corp.google.com [172.16.74.21]) by mx.google.com with ESMTPS id m10sm5338790wbc.16.2010.12.23.06.13.45 (version=SSLv3 cipher=RC4-MD5); Thu, 23 Dec 2010 06:13:45 -0800 (PST) Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-System-Of-Record: true X-MIME-Autoconverted: from 8bit to quoted-printable by smtp-out.google.com id oBNEDmPE028390 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Thu, 23 Dec 2010 10:50:19 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:133926 Archived-At: On Wed, Sep 01, 2010 at 03:09:14PM +0200, Francesco Potort=EC wrote: > >Currently, etags has no interpretors defined for Python, which prevent= s > >it from recognising Python scripts that have no extension. This patch > >adds a small list of interpretors for this language, which while not > >perfect (e.g. it will fail on specific versions like python2.4), it is > >better than the current situation where all scripts without an extensi= on > >will default to Fortran. >=20 > Sure. >=20 > >Note: I debated adding a more detailed list, but it would get outdated > >quickly, so I left just these three versions. A regular expression for > >the interpreter name would be much better here, would implementing tha= t > >make sense? >=20 > It is simpler than that, see below. Sorry for the very late response. > >+ static const char *Python_interpreters [] =3D > >+ { "python", "python2", "python3", NULL }; >=20 > You just add "python" here. >=20 > >! { "python",Python_help,Python_functions,Python_suffixes,NULL,Pytho= n_interpreters}, >=20 > This is allright. >=20 > Moreover, in get_language_from_interpreter you change this: >=20 > for (lang =3D lang_names; lang->name !=3D NULL; lang++) > if (lang->interpreters !=3D NULL) > for (iname =3D lang->interpreters; *iname !=3D NULL; iname++) > if (streq (*iname, interpreter)) > return lang; >=20 > to something like this: >=20 > for (lang =3D lang_names; lang->name !=3D NULL; lang++) > if (lang->interpreters !=3D NULL) > for (iname =3D lang->interpreters; *iname !=3D NULL; iname++) > --> if (strneq (*iname, interpreter, strlen(*iname))) <-- > return lang; I did this, but then: > This changes the semantics of get_language_from_interpreter so that the > list of interpreters is now a list of initial substrings that are > accepted as interpreters names: I think that this new semantic is more > useful than the previous one. >=20 > If this change is done, one should look through the etags builtin help, > the man page and the info manual and update them with the new semantics= , > if necessary. I looked but didn't find any documentation about this; probably due the fact that the interpretors are not user-customizable? If you can point me to which docs needs to be changed, I'll be glad to. Neither doc/man/etags.1 nor doc/emacs/maintaining.texi list anything about it. Interdiff from the previous patch: =3D=3D=3D modified file 'lib-src/etags.c' --- lib-src/etags.c 2010-12-23 13:52:41 +0000 +++ lib-src/etags.c 2010-12-23 14:05:35 +0000 @@ -757,7 +757,7 @@ static const char *Python_suffixes [] =3D { "py", NULL }; static const char *Python_interpreters [] =3D - { "python", "python2", "python3", NULL }; + { "python", NULL }; static const char Python_help [] =3D "In Python code, `def' or `class' at the beginning of a line\n\ generate a tag."; @@ -1477,7 +1477,7 @@ for (lang =3D lang_names; lang->name !=3D NULL; lang++) if (lang->interpreters !=3D NULL) for (iname =3D lang->interpreters; *iname !=3D NULL; iname++) - if (streq (*iname, interpreter)) + if (strneq (*iname, interpreter, strlen(*iname))) return lang; =20 return NULL; --=20 thanks, iustin