From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: ekurzinger@gmail.com Newsgroups: gmane.emacs.devel Subject: [PATCH] fix python-mode native completion with readline 8.0 Date: Sat, 22 Feb 2020 14:56:18 -0800 Message-ID: <5e51b197.1c69fb81.79ca2.55a0@mx.google.com> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="16785"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Feb 23 00:08:22 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j5dsj-0004HX-S9 for ged-emacs-devel@m.gmane-mx.org; Sun, 23 Feb 2020 00:08:21 +0100 Original-Received: from localhost ([::1]:47842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5dsi-0001lU-SZ for ged-emacs-devel@m.gmane-mx.org; Sat, 22 Feb 2020 18:08:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52339) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5dhF-0007pM-Uz for emacs-devel@gnu.org; Sat, 22 Feb 2020 17:56:31 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5dhE-00060t-Nh for emacs-devel@gnu.org; Sat, 22 Feb 2020 17:56:29 -0500 Original-Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]:40613) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j5dhE-000604-Gx for emacs-devel@gnu.org; Sat, 22 Feb 2020 17:56:28 -0500 Original-Received: by mail-pj1-x1043.google.com with SMTP id 12so2404556pjb.5 for ; Sat, 22 Feb 2020 14:56:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:to:from:subject; bh=Hj8U3RzUqY/BP2gdH6GsBLAqV2LjX8vl1HaNUn6cdzY=; b=ADy5N7Gpv/XHO1vEmXHxy73Bbo8xnl7eE3cMwIaW5AnpVp4H028gO6CgiQFrkV0dl7 fGa7CQYGQGIhtwT3wiy5j3+CVxePy/avfc6rxA6xgVEOIL/4Wb9dTMoL5xxfX98qV76/ Sd3bLQGVjcERv+EOLCKeggZDEyNWlsF2m8Et4GJxV6iGibifRNTKcfCN3HmWcNRlp5Gb F+7qQwVLty7ZDzNPCAf11CDzvFw/wMHKGdx0F961uyP8jOxIDHQGeDmMzIUeyvdrR3p+ hp4F1cmvA8X53JudVYRej8h15vHpPh++FKWwmpl8UlLKJgyp/Hfw+v/M6Gis4Ye50pKU Gu1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:to:from:subject; bh=Hj8U3RzUqY/BP2gdH6GsBLAqV2LjX8vl1HaNUn6cdzY=; b=qCyejNEVluT8RofEjYMv4Rb9HHeQwgv3Sy+XHFccF/f3MDxVIg/enXGavzKH1Bwy5A seM/H2E+gqfqHYRtuAbuljEL927VfrsBhfedo4u18PuhHBaywHKBxzM3kaU6MAnYouOk IEVbhY4OsAyYONJ2b7+lALAAxNdipFaXm2KV6Nf4oehqSLWiFHDKkuxfYVOfwbBZbm0o hLYOIccitrIa6HRlfwm4zETx0VuN9Lct/KvLmQF65wUG3UfXigKYBbXP7xiEyLT6cJ4R v5WShxDnJGU4JAQZJOXwJ/c3WiDXjKhbNnM+RDKV++7NSU/GOgjFkixqtTA3jTG6O3Zk U8hQ== X-Gm-Message-State: APjAAAWWrDlq66taRX9Kup/YbmEG8kTV+lYil5EPpXoW1HvJTO1eess9 uoS+8+RMaBLLTEyU8/i2MO6PM8Yy X-Google-Smtp-Source: APXvYqwu8Jj0ck8QD1uv6QuOONGjvU2FgzBbhPa1/dPDh9qTF5BKVn0xUbetTSK5dRQjt5g08wR18w== X-Received: by 2002:a17:902:b110:: with SMTP id q16mr42499778plr.289.1582412183643; Sat, 22 Feb 2020 14:56:23 -0800 (PST) Original-Received: from localhost (c-73-92-93-89.hsd1.ca.comcast.net. [73.92.93.89]) by smtp.gmail.com with ESMTPSA id c26sm7516974pfj.8.2020.02.22.14.56.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Feb 2020 14:56:23 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::1043 X-Mailman-Approved-At: Sat, 22 Feb 2020 18:07:40 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:245034 Archived-At: 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