Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More flexible py-shell interpreter selection #37836

Closed
mhagger mannequin opened this issue Jan 26, 2003 · 4 comments
Closed

More flexible py-shell interpreter selection #37836

mhagger mannequin opened this issue Jan 26, 2003 · 4 comments

Comments

@mhagger
Copy link
Mannequin

mhagger mannequin commented Jan 26, 2003

BPO 675034
Nosy @smontanaro
Files
  • python-mode.el.patch: Patch file as described above
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2003-08-05.03:30:14.000>
    created_at = <Date 2003-01-26.19:20:43.000>
    labels = []
    title = 'More flexible py-shell interpreter selection'
    updated_at = <Date 2003-08-05.03:30:14.000>
    user = 'https://bugs.python.org/mhagger'

    bugs.python.org fields:

    activity = <Date 2003-08-05.03:30:14.000>
    actor = 'skip.montanaro'
    assignee = 'none'
    closed = True
    closed_date = None
    closer = None
    components = ['Demos and Tools']
    creation = <Date 2003-01-26.19:20:43.000>
    creator = 'mhagger'
    dependencies = []
    files = ['4959']
    hgrepos = []
    issue_num = 675034
    keywords = ['patch']
    message_count = 4.0
    messages = ['42529', '42530', '42531', '42532']
    nosy_count = 3.0
    nosy_names = ['skip.montanaro', 'nnorwitz', 'mhagger']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue675034'
    versions = []

    @mhagger
    Copy link
    Mannequin Author

    mhagger mannequin commented Jan 26, 2003

    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.

    @mhagger mhagger mannequin closed this as completed Jan 26, 2003
    @mhagger mhagger mannequin closed this as completed Jan 26, 2003
    @nnorwitz
    Copy link
    Mannequin

    nnorwitz mannequin commented Feb 2, 2003

    Logged In: YES
    user_id=33168

    How does this relate to patch 574750?

    @mhagger
    Copy link
    Mannequin Author

    mhagger mannequin commented Feb 3, 2003

    Logged In: YES
    user_id=38106

    The two patches are largely orthogonal. This patch would
    provide a workaround until patch 574750 is implemented and
    also a fallback for people who still want to invoke
    "jpython" rather than "jython". If the implementer decides
    to remove the whole "py-toggle-shells" mechanism, then this
    patch would be a kind of substitute, but I am not advocating
    that change.

    @smontanaro
    Copy link
    Contributor

    Logged In: YES
    user_id=44345

    migrated to python-mode project. follow it here:

    https://sourceforge.net/tracker/
    index.php?func=detail&aid=783259&group_id=86916&ati
    d=581351

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant