]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
SF patch #510288 by Kevin J. Butler, mod'd by Barry. This provides
authorBarry Warsaw <barry@python.org>
Thu, 25 Apr 2002 21:31:47 +0000 (21:31 +0000)
committerBarry Warsaw <barry@python.org>
Thu, 25 Apr 2002 21:31:47 +0000 (21:31 +0000)
commit884916112e317d9a590346b7b85199eb7dc98758
treef11765eae81e60db6a5331343f8fca551f1597a1
parentc95cc87447f4c9f3f9f0d17481ddaed313bfc7ac
SF patch #510288 by Kevin J. Butler, mod'd by Barry.  This provides
better auto-recognition of a Jython file vs. a CPython (or agnostic)
file by looking at the #! line more closely, and inspecting the import
statements in the first 20000 bytes (configurable).  Specifically,

(py-import-check-point-max): New variable, controlling how far into
the buffer it will search for import statements.

(py-jpython-packages): List of package names that are Jython-ish.

(py-shell-alist): List of #! line programs and the modes associated
with them.

(jpython-mode-hook): Extra hook that runs when entering jpython-mode
(what about Jython mode? <20k wink>).

(py-choose-shell-by-shebang, py-choose-shell-by-import,
py-choose-shell): New functions.

(python-mode): Use py-choose-shell.

(jpython-mode): New command.

(py-execute-region): Don't use my previous hacky attempt at doing
this, use the new py-choose-shell function.

One other thing this file now does: it attempts to add the proper
hooks to interpreter-mode-alist and auto-mode-alist if they aren't
already there.  Might help with Emacs users since that editor doesn't
come with python-mode by default.
Misc/python-mode.el