Subject: Re: bug#71440: Python Inferior Mode Can’t Recognize My Prompt

From: "shynur ." <[email-masked]>
Date: Sun, 9 Jun 2024 10:11:29 +0000

> You expect that to show colors in Emacs as well?

I don’t care about the color of Python’s prompt in Emacs,
because Emacs has its own color scheme which looks nice!

As long as Python Inferior Mode displays those two
characters (‘►’ and ‘▻’) correctly I’ll happy.

Actually it DOES - there’s no problem when I use Python 
Inferior Mode directly.

The problem occurs when I call ‘python-shell-send-buffer’
from a Python buffer, as mentioned in my original post:
<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71440#5>.

> I suggest to define PS1 and PS2 specially for the inferior Python.

I have to say that this is hard to implement cleanly.

I’ve tried:

    (setopt python-shell-interpreter-args "-i -c sys.ps1,sys.ps2='►▻'")

but it turned out that the ‘PYTHONSTARTUP’ file is loaded 
after the statement following ‘-c’ is executed.

______

I think this can be a feature request: provide an option 
to ignore any setting-color character sequence (eg `\033[32m`)
in XXYYZZ Inferior Mode, because there’re so many REPL
apps using a colored prompt and Emacs may not handle them
properly.