Subject: bug#25306: emacs 25.1 cannot deal with the newer ipython (5.1.0) inferior ansi color

From: Andreas Röhler <[email-masked]>
Date: Sat, 31 Dec 2016 14:26:07 +0100

On 31.12.2016 07:16, XP Chen wrote:
>
>
>
>
>
> In GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.5)
>  of 2016-12-23 built on juergen
> Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
> System Description:    Arch Linux
>
> Configured using:
>  'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
>  --localstatedir=/var --with-x-toolkit=gtk3 --with-xft
>  'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe
>  -fstack-protector-strong' CPPFLAGS=-D_FORTIFY_SOURCE=2
>  LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro'
>
> Configured features:
> XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
> NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
> TOOLKIT_SCROLL_BARS GTK3 X11
>
> Important settings:
>   value of $LC_MONETARY: en_US.UTF-8
>   value of $LC_NUMERIC: en_US.UTF-8
>   value of $LC_TIME: en_US.UTF-8
>   value of $LANG: zh_CN.UTF-8
>   value of $XMODIFIERS: @im=fcitx
>   locale-coding-system: utf-8-unix
>
> Major mode: IPy
>
> Minor modes in effect:
>   compilation-shell-minor-mode: t
>   diff-auto-refine-mode: t
>   recentf-mode: t
>   shell-dirtrack-mode: t
>   display-time-mode: t
>   winner-mode: t
>   window-numbering-mode: t
>   guide-key-mode: t
>   ido-everywhere: t
>   auto-image-file-mode: t
>   show-paren-mode: t
>   tooltip-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   column-number-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>
> Recent messages:
> (No changes need to be saved)
> Saving file /home/chxp/ask...
> Wrote /home/chxp/ask
> Saving file /home/chxp/ask...
> Wrote /home/chxp/ask
> Saving file /home/chxp/ask...
> Wrote /home/chxp/ask
> (No changes need to be saved) [2 times]
> Making completion list...
> mwheel-scroll: Beginning of buffer
>
> Load-path shadows:
> /home/chxp/.emacs.d/el-get/python-mode/extensions/highlight-indentation 
> hides 
> /home/chxp/.emacs.d/el-get/highlight-indentation/highlight-indentation
> /home/chxp/.emacs.d/el-get/python-mode/python-mode hides 
> /usr/share/emacs/site-lisp/python-mode
> /home/chxp/.emacs.d/el-get/ess/lisp/mouseme hides 
> /usr/share/emacs/site-lisp/ess/mouseme
> /home/chxp/.emacs.d/el-get/ess/lisp/essd-els hides 
> /usr/share/emacs/site-lisp/ess/essd-els
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-noweb hides 
> /usr/share/emacs/site-lisp/ess/ess-noweb
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-sta-d hides 
> /usr/share/emacs/site-lisp/ess/ess-sta-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-trns hides 
> /usr/share/emacs/site-lisp/ess/ess-trns
> /home/chxp/.emacs.d/el-get/ess/lisp/msdos hides 
> /usr/share/emacs/site-lisp/ess/msdos
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-sp6w-d hides 
> /usr/share/emacs/site-lisp/ess/ess-sp6w-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-r-package hides 
> /usr/share/emacs/site-lisp/ess/ess-r-package
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-r-args hides 
> /usr/share/emacs/site-lisp/ess/ess-r-args
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-comp hides 
> /usr/share/emacs/site-lisp/ess/ess-comp
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-rutils hides 
> /usr/share/emacs/site-lisp/ess/ess-rutils
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-r-d hides 
> /usr/share/emacs/site-lisp/ess/ess-r-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-sp3-d hides 
> /usr/share/emacs/site-lisp/ess/ess-sp3-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-rdired hides 
> /usr/share/emacs/site-lisp/ess/ess-rdired
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-julia hides 
> /usr/share/emacs/site-lisp/ess/ess-julia
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-generics hides 
> /usr/share/emacs/site-lisp/ess/ess-generics
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-noweb-mode hides 
> /usr/share/emacs/site-lisp/ess/ess-noweb-mode
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-mouse hides 
> /usr/share/emacs/site-lisp/ess/ess-mouse
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-sp5-d hides 
> /usr/share/emacs/site-lisp/ess/ess-sp5-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-sas-d hides 
> /usr/share/emacs/site-lisp/ess/ess-sas-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-sp6-d hides 
> /usr/share/emacs/site-lisp/ess/ess-sp6-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-bugs-d hides 
> /usr/share/emacs/site-lisp/ess/ess-bugs-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-rd hides 
> /usr/share/emacs/site-lisp/ess/ess-rd
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-sta-l hides 
> /usr/share/emacs/site-lisp/ess/ess-sta-l
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-arc-d hides 
> /usr/share/emacs/site-lisp/ess/ess-arc-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-toolbar hides 
> /usr/share/emacs/site-lisp/ess/ess-toolbar
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-s-l hides 
> /usr/share/emacs/site-lisp/ess/ess-s-l
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-r-syntax hides 
> /usr/share/emacs/site-lisp/ess/ess-r-syntax
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-omg-d hides 
> /usr/share/emacs/site-lisp/ess/ess-omg-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-menu hides 
> /usr/share/emacs/site-lisp/ess/ess-menu
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-vst-d hides 
> /usr/share/emacs/site-lisp/ess/ess-vst-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-tracebug hides 
> /usr/share/emacs/site-lisp/ess/ess-tracebug
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-sas-l hides 
> /usr/share/emacs/site-lisp/ess/ess-sas-l
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-r-gui hides 
> /usr/share/emacs/site-lisp/ess/ess-r-gui
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-jags-d hides 
> /usr/share/emacs/site-lisp/ess/ess-jags-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-mode hides 
> /usr/share/emacs/site-lisp/ess/ess-mode
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-inf hides 
> /usr/share/emacs/site-lisp/ess/ess-inf
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-font-lock hides 
> /usr/share/emacs/site-lisp/ess/ess-font-lock
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-roxy hides 
> /usr/share/emacs/site-lisp/ess/ess-roxy
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-site hides 
> /usr/share/emacs/site-lisp/ess/ess-site
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-xls-d hides 
> /usr/share/emacs/site-lisp/ess/ess-xls-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-gretl hides 
> /usr/share/emacs/site-lisp/ess/ess-gretl
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-help hides 
> /usr/share/emacs/site-lisp/ess/ess-help
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-s3-d hides 
> /usr/share/emacs/site-lisp/ess/ess-s3-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-s4-d hides 
> /usr/share/emacs/site-lisp/ess/ess-s4-d
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-r-completion hides 
> /usr/share/emacs/site-lisp/ess/ess-r-completion
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-dde hides 
> /usr/share/emacs/site-lisp/ess/ess-dde
> /home/chxp/.emacs.d/el-get/ess/lisp/julia-mode hides 
> /usr/share/emacs/site-lisp/ess/julia-mode
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-lsp-l hides 
> /usr/share/emacs/site-lisp/ess/ess-lsp-l
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-compat hides 
> /usr/share/emacs/site-lisp/ess/ess-compat
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-eldoc hides 
> /usr/share/emacs/site-lisp/ess/ess-eldoc
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-sas-a hides 
> /usr/share/emacs/site-lisp/ess/ess-sas-a
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-noweb-font-lock-mode hides 
> /usr/share/emacs/site-lisp/ess/ess-noweb-font-lock-mode
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-utils hides 
> /usr/share/emacs/site-lisp/ess/ess-utils
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-bugs-l hides 
> /usr/share/emacs/site-lisp/ess/ess-bugs-l
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-custom hides 
> /usr/share/emacs/site-lisp/ess/ess-custom
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-omg-l hides 
> /usr/share/emacs/site-lisp/ess/ess-omg-l
> /home/chxp/.emacs.d/el-get/ess/lisp/ess hides 
> /usr/share/emacs/site-lisp/ess/ess
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-swv hides 
> /usr/share/emacs/site-lisp/ess/ess-swv
> /home/chxp/.emacs.d/el-get/ess/lisp/make-regexp hides 
> /usr/share/emacs/site-lisp/ess/make-regexp
> /home/chxp/.emacs.d/el-get/ess/lisp/ess-sp4-d hides 
> /usr/share/emacs/site-lisp/ess/ess-sp4-d
> /home/chxp/.emacs.d/el-get/ansi-color/ansi-color hides 
> /usr/share/emacs/25.1/lisp/ansi-color
>
> Features:
> (shadow sort mail-extr emacsbug message idna rfc822 mml mml-sec epg
> mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
> mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils vc-mtn vc-hg
> vc-git vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs python-mode derived
> info-look info which-func thingatpt hippie-exp flymake compile rx
> org-install reftex-dcr reftex-auc reftex reftex-vars dired-sort diff-hl
> vc-dir ewoc vc vc-dispatcher diff-mode shell-completion tramp-cache
> tramp-sh tramp tramp-compat auth-source eieio eieio-core gnus-util
> mm-util help-fns mail-prsvr password-cache tramp-loaddefs trampver
> recentf tree-widget paredit idomenu imenu ob-latex ob-dot ob-C cc-mode
> cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
> cc-defs ob-matlab ob-octave ob-ditaa ob-perl ob-sh shell ob-python ob-R
> ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn
> nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-md ox-latex ox-icalendar
> ox-html ox-ascii ox-publish ox org-element org org-macro org-footnote
> org-pcomplete pcomplete org-list org-faces org-entities noutline outline
> org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table ob-exp
> org-src ob-keys ob-comint comint ansi-color ob-core ob-eval org-compat
> org-macs org-loaddefs find-func cal-menu calendar cal-loaddefs time
> winner window-numbering ibuf-macs edmacro kmacro ibuffer-vc ibuf-ext
> ibuffer fullframe avoid guide-key s ucs-normalize popwin dash smex ido
> multi-term term disp-table ehelp ring easy-mmode advice dired+
> image-dired format-spec image-file dired-x dired-aux cl-macs color-theme
> wid-edit preview-latex tex-site auto-loads .loaddefs el-get
> el-get-autoloading el-get-list-packages el-get-dependencies el-get-build
> el-get-status pp el-get-methods el-get-fossil el-get-svn el-get-pacman
> el-get-github-zip el-get-github-tar el-get-http-zip el-get-http-tar
> el-get-hg el-get-go el-get-git-svn el-get-fink el-get-emacswiki
> el-get-http el-get-notify el-get-emacsmirror el-get-github el-get-git
> el-get-elpa el-get-darcs el-get-cvs el-get-bzr el-get-brew
> el-get-builtin el-get-apt-get el-get-recipes el-get-byte-compile
> el-get-custom cl-seq el-get-core autoload lisp-mnt cl dired paren
> cus-start cus-load finder-inf package epg-config seq byte-opt gv
> bytecomp byte-compile cl-extra help-mode easymenu cconv cl-loaddefs
> pcase cl-lib time-date mule-util china-util tooltip eldoc electric
> uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win
> term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
> tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
> menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
> syntax facemenu font-core frame cl-generic cham georgian utf-8-lang
> misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
> cp51932 hebrew greek romanian slovak czech european ethiopic indian
> cyrillic chinese charscript case-table epa-hook jka-cmpr-hook help
> simple abbrev minibuffer cl-preloaded nadvice loaddefs button faces
> cus-face macroexp files text-properties overlay sha1 md5 base64 format
> env code-pages mule custom widget hashtable-print-readable backquote
> dbusbind inotify dynamic-setting system-font-setting font-render-setting
> move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)
>
> Memory information:
> ((conses 16 629489 30403)
>  (symbols 48 46837 1)
>  (miscs 40 748 490)
>  (strings 32 122129 16038)
>  (string-bytes 1 3544997)
>  (vectors 16 61239)
>  (vector-slots 8 1057808 6878)
>  (floats 8 547 686)
>  (intervals 56 1315 0)
>  (buffers 976 36))
>
> When send python script to the ipython inferior, it shows:
>
>       Python 3.5.2 (default, Nov  7 2016, 11:31:36)
>       Type "copyright", "credits" or "license" for more information.
>
>       IPython 5.1.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.
>       Using matplotlib backend: TkAgg
>
> [J[?7h[?12l[?25h[?2004l---------------------------------------------------------------------------
>       NameError                                 Traceback (most recent 
> call last)
>       <ipython-input-1-b5cc5cb08aa6> in <module>()
>       ----> 1 execfile(r'/tmp/py-shell-completion-setup-code.py') # 
> PYTHON-MODE
>
>       NameError: name 'execfile' is not defined
>
> [J[?7h[?12l[?25h[?2004l---------------------------------------------------------------------------
>       NameError                                 Traceback (most recent 
> call last)
>       <ipython-input-2-a8c6ebfb943a> in <module>()
>       ----> 1 execfile(r'/tmp/ipython-1723HV1.py') # PYTHON-MODE
>
>       NameError: name 'execfile' is not defined
>
>       [?12l[?25h[J[?2004l[6n[?2004h[?25l[?7l[JIn [3]:
> [8D[8C[?12l[?25h[8D[J[?2004l[6n[?2004h[?25l[?7l[JIn
>       [3]:
> [8D[8C[?12l[?25h[8D[J[?2004l[6n[?2004h[?25l[?7l[JIn
>       [3]:
> [8D[8C[?12l[?25h[8D[J[?2004l[6n[?2004h[?25l[?7l[JIn
>       [3]:
> [8D[8C[?12l[?25h[8D[J[?2004l[6n[?2004h[?25l[?7l[JIn
>       [3]:
> [8D[8C[?12l[?25h[8D[J[?2004l[6n[?2004h[?25l[?7l[JIn
>       [3]:
> [8D[8C[?12l[?25h[8D[J[?2004l[6n[?2004h[?25l[?7l[JIn
>       [3]:
> [8D[8C[?12l[?25h[8D[J[?2004l[6n[?2004h[?25l[?7l[JIn
>       [3]: [8D[8C[?12l[?25h
>
> The problem of NameError: name 'execfile' is not defined can ignored
> it. However the ansi color of ipython cannot deal with the emacs25.1
>
>
>
>

Please tell which command called. Also some example code which triggers 
the bug.

BTW looks like python-mode from python-mode.el was used.  If this is the 
case, it is not developed here. Please report the bug either at

https://bugs.launchpad.net/python-mode

or at https://gitlab.com/python-mode-devs/python-mode