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: Liu Hui
Subject: bug#68559: [PATCH] Improve Python shell completion
Date: Sat, 17 Feb 2024 12:36:12 +0800

kobarity <kobarity@gmail.com> writes:

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

How about the following change, which only affects libedit-based
readline? It may enable native completion on mac, but I cannot test
it.

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index b7e43f3fc68..f59bc19367b 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -4286,6 +4286,9 @@ (defcustom python-shell-completion-setup-code
             except:
                 pass
         else:
+            if readline.__doc__ and 'libedit' in readline.__doc__:
+                import tty
+                tty.setraw(0)
             # Try to reuse current completer.
             completer = readline.get_completer()
             if not completer:
@@ -4471,8 +4474,8 @@ (defun python-shell-completion-native-setup ()
                 instance.rlcomplete = new_completer

         if readline.__doc__ and 'libedit' in readline.__doc__:
-            raise Exception('''libedit based readline is known not to work,
-      see etc/PROBLEMS under \"In Inferior Python mode, input is echoed\".''')
+            import tty
+            tty.setraw(0)
             readline.parse_and_bind('bind ^I rl_complete')
         else:
             readline.parse_and_bind('tab: complete')





reply via email to

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