From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Francesco =?utf-8?Q?Potort=C3=AC?= Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] etags: Add a small list of interpretors for Python Date: Wed, 01 Sep 2010 15:09:14 +0200 Message-ID: References: <20100819153606.GO4157@google.com> NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1283346757 5411 80.91.229.12 (1 Sep 2010 13:12:37 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 1 Sep 2010 13:12:37 +0000 (UTC) Cc: emacs-devel@gnu.org To: Iustin Pop Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Sep 01 15:12:35 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 1Oqn7C-0000Vb-7v for ged-emacs-devel@m.gmane.org; Wed, 01 Sep 2010 15:12:34 +0200 Original-Received: from localhost ([127.0.0.1]:47109 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oqn7B-0002Mj-9K for ged-emacs-devel@m.gmane.org; Wed, 01 Sep 2010 09:12:33 -0400 Original-Received: from [140.186.70.92] (port=51584 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oqn6r-000258-Bh for emacs-devel@gnu.org; Wed, 01 Sep 2010 09:12:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oqn68-0005a8-BW for emacs-devel@gnu.org; Wed, 01 Sep 2010 09:11:29 -0400 Original-Received: from mx2.isti.cnr.it ([194.119.192.4]:3317) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oqn67-0005ZI-NZ for emacs-devel@gnu.org; Wed, 01 Sep 2010 09:11:28 -0400 Original-Received: from conversionlocal.isti.cnr.it by mx.isti.cnr.it (PMDF V6.5 #31825) id <01NRDO11CGHCIBD9Y3@mx.isti.cnr.it> for emacs-devel@gnu.org; Wed, 01 Sep 2010 15:09:20 +0100 Original-Received: from tucano.isti.cnr.it (tucano.isti.cnr.it [146.48.81.102]) by mx.isti.cnr.it (PMDF V6.5 #31826) with ESMTPSA id <01NRDO0XWK8QIU22YP@mx.isti.cnr.it>; Wed, 01 Sep 2010 15:09:18 +0100 Original-Received: from pot by tucano.isti.cnr.it with local (Exim 4.72) (envelope-from ) id 1Oqn3y-0008MG-P9; Wed, 01 Sep 2010 15:09:14 +0200 In-reply-to: <20100819153606.GO4157@google.com> X-INSM-ip-source: 146.48.81.102 Auth Done X-fingerprint: 4B02 6187 5C03 D6B1 2E31 7666 09DF 2DC9 BE21 6115 X-detected-operating-system: by eggs.gnu.org: OpenVMS 7.2 (Multinet 4.3-4.4 stack) 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:129553 Archived-At: >Currently, etags has no interpretors defined for Python, which prevents >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 extension >will default to Fortran. Sure. >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 that >make sense? It is simpler than that, see below. >+ static const char *Python_interpreters [] = >+ { "python", "python2", "python3", NULL }; You just add "python" here. >! { "python",Python_help,Python_functions,Python_suffixes,NULL,Python_interpreters}, This is allright. Moreover, in get_language_from_interpreter you change this: for (lang = lang_names; lang->name != NULL; lang++) if (lang->interpreters != NULL) for (iname = lang->interpreters; *iname != NULL; iname++) if (streq (*iname, interpreter)) return lang; to something like this: for (lang = lang_names; lang->name != NULL; lang++) if (lang->interpreters != NULL) for (iname = lang->interpreters; *iname != NULL; iname++) --> if (strneq (*iname, interpreter, strlen(*iname))) <-- return lang; 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. 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 should be the one to do that, as the etags' maintainer, but I am sure that this work will proceed much more quickly if you do it :)