bug#41959: Subject: 27.0.91; comint-prompt-regexp in Python mode is incorrect and causes completion failures
M-x run-python brings up a warning buffer with the following message:
Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to
support readline, yet ‘python-shell-completion-native-enable’ was t
and "python" is not part of the
‘python-shell-completion-native-disabled-interpreters’ list. Native
completions have been disabled locally.
This warning is unwarranted, because the python-shell-interpreter being
invoked in fact supports readline (as can be readily checked via
"import readline, rlcompleter").
Tracing through the code it appears that
python-shell-completion-native-setup erroneously returns nil, because
This, however, appears to be caused by the fact that the comint prompt
in Python mode is expected to look like ">>> ", which is a bad
assumption. When readline is run with "set show-mode-in-prompt on"
option, the comint prompt will be prefixed with the readline mode
indicator, so it will look like "@>>> ", or "(ins)>>> ", or "+>>> ",
depending on user's configuration (typically in ~/.inputrc).
In short, comint-prompt-regexp assumes a very specific environment, and
when comint prompt fails to match these expectations it causes unrelated
failures in e.g. completion functions.
In GNU Emacs 27.0.91 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
of 2020-06-08 built on meitner
Repository revision: 0260d2d2dbb2607e7310bdb518b7b6c0f58f5f98
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version 11.0.12008000
System Description: Ubuntu 20.04 LTS
For information about GNU Emacs and the GNU system, type C-h C-a.
Waiting for git... [2 times]
Shell native completion is disabled, using fallback
V is undefined
Mark set [2 times]
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
Major mode: Special
Minor modes in effect: