[Top][All Lists]

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

[PATCH] fix python-mode native completion with readline 8.0

From: ekurzinger
Subject: [PATCH] fix python-mode native completion with readline 8.0
Date: Sat, 22 Feb 2020 14:56:18 -0800

Hi Everyone,

I've noticed that python-mode's native completion feature doesn't seem to work
with readline 8.0. When python-mode is enabled it displays the following
warning, and native completion is turned off:

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.

With readline 7.0 there are no issues. I believe this is because, as of version
8.0, readline will append a couple of escape codes to its completion candidates
(^[[0m and ^[[K) which interfere with one of the regexps python-mode uses for
native completions.

This small patch resolves the issue for me, and shouldn't break existing
functionality on older readline versions. Let me know what you think.

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index a2d85d0bef..60508340c3 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -3629,7 +3629,7 @@ python-shell-completion-native-get-completions
                   (comint-redirect-perform-sanity-check nil)
                   (comint-redirect-insert-matching-regexp t)
-                   "1__dummy_completion__[[:space:]]*\n")
                   (comint-redirect-output-buffer redirect-buffer))
               ;; Compatibility with Emacs 24.x.  Comint changed and
               ;; now `comint-redirect-filter' gets 3 args.  This


reply via email to

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