[Patches] [ python-Patches-675034 ] More flexible py-shell interpreter selection

SourceForge.net noreply@sourceforge.net
Sun, 02 Feb 2003 10:11:31 -0800


Patches item #675034, was opened at 2003-01-26 14:20
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=675034&group_id=5470

Category: Demos and tools
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Michael Haggerty (mhagger)
Assigned to: Nobody/Anonymous (nobody)
Summary: More flexible py-shell interpreter selection

Initial Comment:
Currently in python-mode.el, py-which-shell (the
command used to start the python interpreter) is
limited to "python" or "jpython".  This patch makes it
possible to specify an arbitrary command at invocation
time, including a command that is specified relative to
the current path.

The problem: I am working on a project where jython is
embedded within our application.  The application
optionally allows console access to the jython
interpreter.  The application is started by running a
shell script which sets some environment variables then
invokes the jython interpreter with a large number of
arguments.

I would like to use py-shell within emacs to interact
with the application.  However, it is impractical to
start the application under py-shell for two reasons:

1. The command that needs to be invoked is neither
"python" nor "jython", and in fact would require many
arguments;

2. The command is not necessary installed in the PATH.

Similar problems occur even if one sometimes wants to
start an alternative python interpreter (such as
"python2" under redhat) or an interpreter that is not
in PATH (for example, if testing a new version of
python).

Therefore I have written a patch to python-mode.py that
changes the py-shell command as follows:

+ If there is no prefix argument, the usual python (or
jython) interpreter is invoked without further
interaction as before.

+ If there is a prefix argument, then the user is asked
what command to invoke with the "standard command" as
the default input:

    command: python -i

The user can edit the command to run whatever s/he
wants.

+ The command typed by the user is invoked via "$SHELL
-c 'COMMAND'" so that the user's program is first
sought in the emacs default directory (generally, the
directory related to the current emacs buffer).  This
allows the user to type, for example,

    command: ./my_test_interpreter -i

I am a novice at emacs lisp, but the patch is simple
(only about 10 lines changed) and it seems to work for
me.

The patch applies to the CVS version of python-mode.el
as of today (2003-01-26), but the same patch can be
applied to the version that was released with
Python-2.1.


----------------------------------------------------------------------

>Comment By: Neal Norwitz (nnorwitz)
Date: 2003-02-02 13:11

Message:
Logged In: YES 
user_id=33168

How does this relate to patch 574750?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=675034&group_id=5470