From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dan Davison Newsgroups: gmane.emacs.bugs Subject: bug#24322: [PATCH] Re: 25.1.50; Python completion should not strip trailing space Date: Sat, 27 Aug 2016 21:47:02 +0000 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113ec7f4dff218053b1492d5 X-Trace: blaine.gmane.org 1472334504 12664 195.159.176.226 (27 Aug 2016 21:48:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 27 Aug 2016 21:48:24 +0000 (UTC) To: 24322@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Aug 27 23:48:19 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdlSa-0002UZ-WE for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Aug 2016 23:48:17 +0200 Original-Received: from localhost ([::1]:37297 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdlSY-0006VM-Iu for geb-bug-gnu-emacs@m.gmane.org; Sat, 27 Aug 2016 17:48:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdlSR-0006Th-7n for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2016 17:48:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bdlSM-0000VB-Ak for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2016 17:48:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:44535) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bdlSM-0000V3-6n for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2016 17:48:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bdlSL-00039S-TW for bug-gnu-emacs@gnu.org; Sat, 27 Aug 2016 17:48:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dan Davison Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Aug 2016 21:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24322 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24322-submit@debbugs.gnu.org id=B24322.147233444112062 (code B ref 24322); Sat, 27 Aug 2016 21:48:01 +0000 Original-Received: (at 24322) by debbugs.gnu.org; 27 Aug 2016 21:47:21 +0000 Original-Received: from localhost ([127.0.0.1]:42247 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdlRg-00038T-TK for submit@debbugs.gnu.org; Sat, 27 Aug 2016 17:47:21 -0400 Original-Received: from mail-it0-f45.google.com ([209.85.214.45]:37035) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bdlRe-00038H-Pt for 24322@debbugs.gnu.org; Sat, 27 Aug 2016 17:47:19 -0400 Original-Received: by mail-it0-f45.google.com with SMTP id d65so46403611ith.0 for <24322@debbugs.gnu.org>; Sat, 27 Aug 2016 14:47:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=sZngcmN1TOI5RC/7bAyqMu4dprXMpE2LopI4eh99XCE=; b=oZRDfUnYiTAZIvipJNYdcjyHh9eMDUlGn5hu6QjRyzbYp2sPWkJVJoNWKrHMCQYiGZ iWQknxMkPZorIZyx2mUZbyj3UEyzcWpQpF4MpqU4fHUty/BALvvpi+u8J9RyIo5XeGl9 JXzthzQd5U5ps7Cps116Pznw6K425Kfc41I7KaqApIs2qD4B5xAzUf7z0AeyejDn05b9 ZXIxMp2Un+5Hiq3OLkDGA357nKTxZfPIqAuokLJLz2Sg+/AgOHeuDcroSiDo2fy+74H9 Sfk6IzwuSxkwIHwuBSl7/fpp9y9tUD3sL2blXypzbDDZkpocQn6TNdOxKg7RaKyqbbPS ePQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=sZngcmN1TOI5RC/7bAyqMu4dprXMpE2LopI4eh99XCE=; b=S211NiiEkpbEdOmSurN/x8sM6IhRyA5X5Yzf08oIxNoOo9ahcA8/X7AcxQS4lBV8l2 uh5qBh04EtY5FOSQFY6rRHMaDqF2J9v8HU7bbLc2imF40cIqUFObykmq49iaj2Eg7uLK EWfSUMadYe0fTff4JLzt8iKeLDYWwJRPRn7VD/qL0JMhCJHFscA6A3+Y3gFL2wWgEFkx zV7AkZg1DIc5Y+G/3PGaxkWpSaMHZNhUczXzccHoAPeQos07hxbmo11TLnOBQqa6zKLD /7wWIN9TuxGpcMEgcp8jdJFDtGM+PhrLPKmYcGvHqD4kcEcYeaadkSZe95tTq1njKCC2 bDkQ== X-Gm-Message-State: AE9vXwMNVRtGEgLM2wW3SaJA1nJjy5x4KkitA255jwrjEe3bXSmMq9PDDTE0gTUIQCgh+iR5R+kMMZ/eUjMy9Q== X-Received: by 10.107.11.170 with SMTP id 42mr12095323iol.184.1472334433081; Sat, 27 Aug 2016 14:47:13 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:122729 Archived-At: --001a113ec7f4dff218053b1492d5 Content-Type: text/plain; charset=UTF-8 Here is the patch pasted into the body of an email: >From 8e69b33a53ea30389a5e3946dd711320a77e0d23 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Fri, 5 Aug 2016 12:19:20 -0700 Subject: [PATCH] Don't strip space from python completions The returned completion deliberately includes a space after a word like 'import', which is always followed by more words. * lisp/progmodes/python.el (python-shell-completion-native-get-completions): Remove space from regular expression character class --- lisp/progmodes/python.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ad69f87..8616279 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3551,7 +3551,7 @@ completion." (split-string (buffer-substring-no-properties (line-beginning-position) (point-min)) - "[ \f\t\n\r\v()]+" t) + "[\f\t\n\r\v()]+" t) :test #'string=)))) (set-process-filter process original-filter-fn))))) -- 2.3.2 (Apple Git-55) On Sat, 27 Aug 2016 at 14:21 Dan Davison wrote: > Patch attached. > > This patch is also available as a pull request at at > https://github.com/dandavison/emacs/pull/1 The commit hash > is 8e69b33a53ea30389a5e3946dd711320a77e0d23. > > I have only tested this on macOS. As far as I am aware, when the space > character is present, it is present deliberately and it is appropriate to > retain it, but I would appreciate feedback from python.el experts. > > On Sat, 27 Aug 2016 at 14:10 Dan Davison wrote: > >> From emacs -Q: >> >> (setq python-shell-interpreter "ipython" >> python-shell-interpreter-args "-i") >> >> M-x run-python >> >> In the python comint buffer insert "from itertools imp" and hit tab. >> >> You will see "imp" completed as "import" (no trailing space). >> >> However, if you do this in ipython itself, you will see "imp" completed >> as "import ". This (i.e. what ipython does) is the desired behavior >> (because import is always followed by another word). >> >> In GNU Emacs 25.1.50.1 (x86_64-apple-darwin14.5.0, NS appkit-1348.17 >> Version 10.10.5 (Build 14F27)) >> of 2016-04-16 built on hemiprocne >> Repository revision: 934549e23d6bda5231375dbfed7b42a966c85d14 >> Windowing system distributor 'Apple', version 10.3.1348 >> Configured using: >> 'configure --prefix=/usr/local/Cellar/emacs/HEAD >> --enable-locallisppath=/usr/local/share/emacs/site-lisp >> --infodir=/usr/local/Cellar/emacs/HEAD/share/info/emacs --with-xml2 >> --without-dbus --without-gnutls --with-ns --disable-ns-self-contained' >> >> Configured features: >> JPEG NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS >> >> Important settings: >> value of $LANG: en_US.UTF-8 >> locale-coding-system: utf-8-unix >> >> Major mode: Lisp Interaction >> >> Minor modes in effect: >> tooltip-mode: t >> global-eldoc-mode: t >> electric-indent-mode: t >> mouse-wheel-mode: t >> tool-bar-mode: t >> menu-bar-mode: t >> file-name-shadow-mode: t >> global-font-lock-mode: t >> font-lock-mode: t >> blink-cursor-mode: t >> auto-composition-mode: t >> auto-encryption-mode: t >> auto-compression-mode: t >> line-number-mode: t >> transient-mark-mode: t >> >> Recent messages: >> For information about GNU Emacs and the GNU system, type C-h C-a. >> >> Load-path shadows: >> None found. >> >> Features: >> (shadow sort mail-extr emacsbug message dired dired-loaddefs format-spec >> rfc822 mml easymenu mml-sec password-cache epa derived epg epg-config >> gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse >> rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 >> ietf-drums mm-util mail-prsvr mail-utils time-date mule-util tooltip >> eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel >> term/ns-win ns-win ucs-normalize term/common-win tool-bar dnd fontset >> image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode >> prog-mode register page menu-bar rfn-eshadow timer select scroll-bar >> mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame >> cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan thai >> tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian >> slovak czech european ethiopic indian cyrillic chinese charscript >> case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer >> cl-preloaded nadvice loaddefs button faces cus-face macroexp files >> text-properties overlay sha1 md5 base64 format env code-pages mule >> custom widget hashtable-print-readable backquote kqueue cocoa ns >> multi-tty make-network-process emacs) >> >> Memory information: >> ((conses 16 195970 9329) >> (symbols 48 19431 0) >> (miscs 40 43 170) >> (strings 32 14792 5110) >> (string-bytes 1 431078) >> (vectors 16 32763) >> (vector-slots 8 640839 4764) >> (floats 8 156 54) >> (intervals 56 194 0) >> (buffers 976 11)) >> >> --001a113ec7f4dff218053b1492d5 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Here is the patch pasted into the body of an email:
From 8e69b33a53ea30389a5e3946dd711320a77e0d23 Mon Sep 17 = 00:00:00 2001
From: Dan Davison <dandavison7@gmail.com>
Date: Fri, 5 Aug 2016 1= 2:19:20 -0700
Subject: [PATCH] Don't strip space from python = completions

The returned completion deliberately i= ncludes a space after a word like
'import', which is alwa= ys followed by more words.

* lisp/progmodes/python= .el (python-shell-completion-native-get-completions):
Remove spac= e from regular expression character class
---
=C2=A0lis= p/progmodes/python.el | 2 +-
=C2=A01 file changed, 1 insertion(+)= , 1 deletion(-)

diff --git a/lisp/progmodes/python= .el b/lisp/progmodes/python.el
index ad69f87..8616279 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.= el
@@ -3551,7 +3551,7 @@ completion."
=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (split-string
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(buf= fer-substring-no-properties
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (line-beginning-position) (point-min))
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&q= uot;[ \f\t\n\r\v()]+" t)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"[\f\t\n\r\v()]+" t)
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 :test #'str= ing=3D))))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(set-process-filter = process original-filter-fn)))))
=C2=A0
--=C2=A0
2.3.2 (Apple Git-55)


On Sat, 27 Aug 2016 at 14:21 Dan Davison <<= a href=3D"mailto:dandavison7@gmail.com">dandavison7@gmail.com> wrote= :
Patch attached.<= div>
This patch is also available as a pull request at at=C2= =A0https://github.com/dandavison/emacs/pull/1=C2=A0The commit hash is=C2= =A08e69b33a53ea30389a5e3946dd711320a77e0d23.

I hav= e only tested this on macOS. As far as I am aware, when the space character= is present, it is present deliberately and it is appropriate to retain it,= but I would appreciate feedback from python.el experts.

On Sat, 27 Aug 2016 at 14:10 Dan Da= vison <dandav= ison7@gmail.com> wrote:
From emacs -Q:

(setq python-shel= l-interpreter "ipython"
=C2=A0 =C2=A0 =C2=A0 python-she= ll-interpreter-args "-i")

M-x run-python=

In the python comint buffer insert "from ite= rtools imp" and hit tab.

You will see "i= mp" completed as "import" (no trailing space).
However, if you do this in ipython itself, you will see "i= mp" completed
as "import ". This (i.e. what ipytho= n does) is the desired behavior
(because import is always followe= d by another word).

In GNU Emacs 25.1.50.1 (x86_64= -apple-darwin14.5.0, NS appkit-1348.17 Version 10.10.5 (Build 14F27))
=
=C2=A0of 2016-04-16 built on hemiprocne
Repository revision:= 934549e23d6bda5231375dbfed7b42a966c85d14
Windowing system distri= butor 'Apple', version 10.3.1348
Configured using:
<= div>=C2=A0'configure --prefix=3D/usr/local/Cellar/emacs/HEAD
= =C2=A0--enable-locallisppath=3D/usr/local/share/emacs/site-lisp
= =C2=A0--infodir=3D/usr/local/Cellar/emacs/HEAD/share/info/emacs --with-xml2=
=C2=A0--without-dbus --without-gnutls --with-ns --disable-ns-sel= f-contained'

Configured features:
JP= EG NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS

= Important settings:
=C2=A0 value of $LANG: en_US.UTF-8
= =C2=A0 locale-coding-system: utf-8-unix

Major mode= : Lisp Interaction

Minor modes in effect:
=C2=A0 tooltip-mode: t
=C2=A0 global-eldoc-mode: t
= =C2=A0 electric-indent-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2=A0 menu-bar-mode: t
=C2= =A0 file-name-shadow-mode: t
=C2=A0 global-font-lock-mode: t
=C2=A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: t
<= div>=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryption-mode: = t
=C2=A0 auto-compression-mode: t
=C2=A0 line-number-mo= de: t
=C2=A0 transient-mark-mode: t

Rece= nt messages:
For information about GNU Emacs and the GNU system, = type C-h C-a.

Load-path shadows:
None fo= und.

Features:
(shadow sort mail-extr em= acsbug message dired dired-loaddefs format-spec
rfc822 mml easyme= nu mml-sec password-cache epa derived epg epg-config
gnus-util rm= ail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse
rfc22= 31 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-= drums mm-util mail-prsvr mail-utils time-date mule-util tooltip
e= ldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/ns-win ns-win ucs-normalize term/common-win tool-bar dnd fontset
image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mod= e
prog-mode register page menu-bar rfn-eshadow timer select scrol= l-bar
mouse jit-lock font-lock syntax facemenu font-core term/tty= -colors frame
cl-generic cham georgian utf-8-lang misc-lang vietn= amese tibetan thai
tai-viet lao korean japanese eucjp-ms cp51932 = hebrew greek romanian
slovak czech european ethiopic indian cyril= lic chinese charscript
case-table epa-hook jka-cmpr-hook help sim= ple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs butto= n faces cus-face macroexp files
text-properties overlay sha1 md5 = base64 format env code-pages mule
custom widget hashtable-print-r= eadable backquote kqueue cocoa ns
multi-tty make-network-process = emacs)

Memory information:
((conses 16 1= 95970 9329)
=C2=A0(symbols 48 19431 0)
=C2=A0(miscs 40 = 43 170)
=C2=A0(strings 32 14792 5110)
=C2=A0(string-byt= es 1 431078)
=C2=A0(vectors 16 32763)
=C2=A0(vector-slo= ts 8 640839 4764)
=C2=A0(floats 8 156 54)
=C2=A0(interv= als 56 194 0)
=C2=A0(buffers 976 11))

<= /blockquote> --001a113ec7f4dff218053b1492d5--