GNU bug report logs - #25306
emacs 25.1 cannot deal with the newer ipython (5.1.0) inferior ansi color

Previous Next

Package: emacs;

Reported by: "XP Chen" <chxp_moon <at> 163.com>

Date: Sat, 31 Dec 2016 06:43:02 UTC

Severity: normal

Tags: fixed

Merged with 21381, 24189, 24223, 25222, 25363, 25416

Found in versions 24.5, 25.1, 25.1.50, 25.1.91

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


Message #21 received at 25306 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: 25306 <at> debbugs.gnu.org
Cc: andreas.roehler <at> aesy-emacs.de, chxp_moon <at> 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
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




This bug report was last modified 7 years and 324 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.