bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#68559: [PATCH] Improve Python shell completion


From: kobarity
Subject: bug#68559: [PATCH] Improve Python shell completion
Date: Wed, 21 Feb 2024 22:13:45 +0900
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (Gojō) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

Mattias Engdegård wrote:
> 17 feb. 2024 kl. 14.33 skrev kobarity <kobarity@gmail.com>:
> > On Mac, it might be better to set the default value of
> > `python-shell-completion-native-enable' to nil.
> Not sure why the inferior Python process doesn't act on a TAB being sent to 
> it. Is the tty somehow in a state that disables readline/libedit? Something 
> that Emacs does when setting up the pty?

On Mac, there are two independent problems.  One problem, which
existed before Liu's patch was applied, is that native completions
cannot be enabled.  The other problem is that the test now fails after
applying Liu's patch.  Suppressing echo back solves the latter, but
not the former.  Because of the former, leaving
`python-shell-completion-native-enable' at the default setting of t
will result in the warning.

There are two completions methods, native and non-native.  If native
completions cannot be used, it falls back to non-native completions.
Native completions is triggered by sending TAB character, while
non-native completions is triggered by sending and evaluating
__PYTHON_EL_get_completions().

As far as I have tried, native completions cannot be enabled for
libedit-based readline package, even on Linux.

So, there are two ways for Mac users to avoid the warning.  One is to
use gnureadline instead of libedit, and the other is to give up native
completions and set `python-shell-completion-native-enable' to nil.
This remains correct even with echo back disabled.

> Of course from a software engineering point of view, it's silly to send what 
> essentially are edit keystrokes to Python and then screen-scrape the output. 
> A proper interaction protocol would be the way to go, and would work equally 
> well on any platform including Windows.

I think the protocol between python.el and inferior Python process is
already platform independent.  Protocol violations are echo back.

> Thanks for your patches. I suggest we apply your set-tty-raw patch on master 
> now since it cures the test failures without breaking anything else (on Mac; 
> I'm assuming no regression elsewhere).
> 
> Would you like me to do that for you?

Yes, please.  Thank you.  I have no commit right.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]