emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] etags: Add a small list of interpretors for Python


From: Francesco Potortì
Subject: Re: [PATCH] etags: Add a small list of interpretors for Python
Date: Wed, 01 Sep 2010 15:09:14 +0200

>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 :)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]