Subject: bug#68559: [PATCH] Improve Python shell completion

From: Mattias Engdegård <[email-masked]>
Date: Fri, 16 Feb 2024 21:10:15 +0100

16 feb. 2024 kl. 16.24 skrev kobarity <[email-masked]>:

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

Nice, thank you! I can confirm that they both appear to work, at least in the sense that the python-tests pass (except for the ones skipped intentionally), and the python shell behaves reasonable.

Only the set-tty-mode patch eliminates echo in the interactive python shell; in that sense it's preferable.

Both produce the very annoying warning

  Warning (python): Your ‘python-shell-interpreter’ doesn’t seem to support readline, yet ‘python-shell-completion-native-enable’ was t and "python3" is not part of the ‘python-shell-completion-native-disabled-interpreters’ list.  Native completions have been disabled locally. Consider installing the python package "readline".

which is not even correct since the standard Python does have a working readline module, even if it uses libedit.

> 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.

Right, that test runs and passes.

>  If it is safe to set tty to raw
> mode on all UNIX based systems, I prefer this method.

Same here. I see no reason why it wouldn't be safe, either.

> 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.

Indeed, it does seem a bit extravagant.