GNU bug report logs - #68559
[PATCH] Improve Python shell completion

Previous Next

Package: emacs;

Reported by: Liu Hui <liuhui1610 <at> gmail.com>

Date: Thu, 18 Jan 2024 04:50:01 UTC

Severity: wishlist

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #125 received at 68559 <at> debbugs.gnu.org (full text, mbox):

From: Liu Hui <liuhui1610 <at> gmail.com>
To: kobarity <kobarity <at> gmail.com>
Cc: Mattias EngdegÄrd <mattias.engdegard <at> gmail.com>,
 Eli Zaretskii <eliz <at> gnu.org>, 68559 <at> debbugs.gnu.org
Subject: Re: bug#68559: [PATCH] Improve Python shell completion
Date: Sat, 17 Feb 2024 12:36:12 +0800
kobarity <kobarity <at> 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')




This bug report was last modified 1 year and 100 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.