From: Iustin Pop <iustin@google.com>
To: "Francesco Potortì" <pot@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: [PATCH] etags: Add a small list of interpretors for Python
Date: Thu, 23 Dec 2010 15:13:44 +0100 [thread overview]
Message-ID: <20101223141344.GB18711@google.com> (raw)
In-Reply-To: <E1Oqn3y-0008MG-P9@tucano.isti.cnr.it>
On Wed, Sep 01, 2010 at 03:09:14PM +0200, Francesco Potortì wrote:
> >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.
Sorry for the very late response.
> >+ 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;
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.
>
> 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:
=== 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 [] =
{ "py", NULL };
static const char *Python_interpreters [] =
- { "python", "python2", "python3", NULL };
+ { "python", NULL };
static const char Python_help [] =
"In Python code, `def' or `class' at the beginning of a line\n\
generate a tag.";
@@ -1477,7 +1477,7 @@
for (lang = lang_names; lang->name != NULL; lang++)
if (lang->interpreters != NULL)
for (iname = lang->interpreters; *iname != NULL; iname++)
- if (streq (*iname, interpreter))
+ if (strneq (*iname, interpreter, strlen(*iname)))
return lang;
return NULL;
--
thanks,
iustin
next prev parent reply other threads:[~2010-12-23 14:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-19 15:36 [PATCH] etags: Add a small list of interpretors for Python Iustin Pop
2010-09-01 11:53 ` Iustin Pop
2010-09-01 13:09 ` Francesco Potortì
2010-12-23 14:13 ` Iustin Pop [this message]
2011-01-12 16:43 ` Francesco Potortì
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=20101223141344.GB18711@google.com \
--to=iustin@google.com \
--cc=emacs-devel@gnu.org \
--cc=pot@gnu.org \
/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.