unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 25306@debbugs.gnu.org
Cc: andreas.roehler@aesy-emacs.de, chxp_moon@163.com
Subject: bug#25306: emacs 25.1 cannot deal with the newer ipython (5.1.0) inferior ansi color
Date: Sun, 21 May 2017 16:35:47 -0700	[thread overview]
Message-ID: <87o9ulrdf0.fsf@gmail.com> (raw)
In-Reply-To: <145c557a.d8.1595385e43e.Coremail.chxp_moon@163.com>

Correct me if this is not what the original bug is about, but it seems
that to reproduce this, one can:

1. Install latest ipython: "pip install -U ipython"
2. Evaluate the following (setq python-shell-interpreter "ipython"
                                python-shell-interpreter-args "")
3. M-x run-python

You should see special characters used by ipython appear at the prompt
already, like:

--8<---------------cut here---------------start------------->8---
Python 2.7.6 (default, Oct 26 2016, 20:30:19) 
Type "copyright", "credits" or "license" for more information.

IPython 5.3.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

[6n[JIn [1]: [8D[8C[8D[J[6n[JIn [1]: [8D[8C
--8<---------------cut here---------------end--------------->8---

It seems those would be a mix of color and control ANSI escape codes
[0]. The dumb shells based on comint do not support ANSI. I'm not sure
supporting these would be desirable as part of comint. It seems that in
the context of emacs, the answer is no; Emacs comes with its own
facilities for line editing; and using those for every command
interpreter makes the experience consistent.

In this particular case, there exists an option to tell IPython to
refrain from sending ANSI codes, and that option is
"--simple-prompt". It does have a few limitations though. The ones which
I know are:

1. No multi-line editing support. [1]
2. Doesn't set up an event loop, which breaks when using
ipdb.set_trace() [2]

For these reasons maybe it would make sense to have a facility simply
"strip" all the ANSI escape codes from the responses (and not use the
"--simple-prompt" until the quirks get ironed out).

Thoughts?

Maxim

[0] https://en.wikipedia.org/wiki/ANSI_escape_code
[1] https://github.com/ipython/ipython/issues/9816
[2] https://github.com/ipython/ipython/issues/10577





  parent reply	other threads:[~2017-05-21 23:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-31  6:16 bug#25306: emacs 25.1 cannot deal with the newer ipython (5.1.0) inferior ansi color XP Chen
2016-12-31 13:26 ` Andreas Röhler
2017-05-21 23:35 ` Maxim Cournoyer [this message]
2017-07-03 15:24 ` npostavs

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o9ulrdf0.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=25306@debbugs.gnu.org \
    --cc=andreas.roehler@aesy-emacs.de \
    --cc=chxp_moon@163.com \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).