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: Sat, 17 Feb 2024 00:24:29 +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:
> 
> 16 feb. 2024 kl. 10.34 skrev kobarity <kobarity@gmail.com>:
> 
> > This is caused by the fact that the input is echoed back on MacOS
> > Python.
> 
> Right, that bug needs to be fixed as well, but the echo problem existed prior 
> to the change that broke the tests.
> 
> An alternative might be to disable the tty echo altogether. If I do it right 
> after process creation then it has no effect; presumably Python or its 
> readline module turns on echo just a bit later on. Anyway, running
> 
>   import tty
>   tty.setraw(0)
> 
> in the python shell seems to put it right, with working completion and the 
> annoying echo gone.
> 
> > So one workaround would be to remove the echoed back string before
> > parsing as JSON.
> 
> Yes, either that or turning off echo in the tty.

I made prototype patches for each method.  I don't use Mac so it would
be helpful if you could try these.

0001-Remove-echoed-back-string-in-python-shell-completion.patch
extracts only the last line to exclude echoed back strings.

0001-Set-tty-mode-to-raw-when-setting-up-Inferior-Python.patch sets
the Inferior Python tty to raw mode.  python-ffap-module-path-1 will
no longer need to be skipped on Mac.  If it is safe to set tty to raw
mode on all UNIX based systems, I prefer this method.

By the way, is it necessary to send
`python-shell-completion-setup-code' for every completion in
`python-shell-completion-get-completions'?  To me it seems sufficient
to send it once at initialization.

Attachment: 0001-Remove-echoed-back-string-in-python-shell-completion.patch
Description: Binary data

Attachment: 0001-Set-tty-mode-to-raw-when-setting-up-Inferior-Python.patch
Description: Binary data


reply via email to

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