all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] fix python-mode native completion with readline 8.0
@ 2020-02-22 22:56 ekurzinger
  0 siblings, 0 replies; only message in thread
From: ekurzinger @ 2020-02-22 22:56 UTC (permalink / raw)
  To: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1676 bytes --]

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)
                   (comint-redirect-finished-regexp
-                   "1__dummy_completion__[[:space:]]*\n")
+                   "1__dummy_completion__\\(\x1b\\[0m\x1b\\[K\\)?[[:space:]]*\n")
                   (comint-redirect-output-buffer redirect-buffer))
               ;; Compatibility with Emacs 24.x.  Comint changed and
               ;; now `comint-redirect-filter' gets 3 args.  This

Cheers,
Erik



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-02-22 22:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-22 22:56 [PATCH] fix python-mode native completion with readline 8.0 ekurzinger

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.