GNU bug report logs - #47575
python-shell-completion-at-point omits %magic commands

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: JD Smith <jdtsmith@HIDDEN>; dated Sat, 3 Apr 2021 04:23:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 47575 <at> debbugs.gnu.org:


Received: (at 47575) by debbugs.gnu.org; 6 May 2021 11:05:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 06 07:05:16 2021
Received: from localhost ([127.0.0.1]:37392 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1leboh-00058w-R8
	for submit <at> debbugs.gnu.org; Thu, 06 May 2021 07:05:16 -0400
Received: from quimby.gnus.org ([95.216.78.240]:47356)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1lebof-00058m-UO
 for 47575 <at> debbugs.gnu.org; Thu, 06 May 2021 07:05:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID
 :In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe:
 List-Post:List-Owner:List-Archive;
 bh=dZqzY8eaAj9T6myNLvh1tE0zLZwLmdCjTA80x+uTLgE=; b=rF67Y/315YZaimWYopRMPCAS3M
 VnvZ4eke0S2nFyVJouNFH8ijc6nEglIjDLd/OVjURHkBoptqGvKElLPRSN6zf5oyBQaQqJ3B6J9KS
 CZ0LqPEuPLJT8o+N7CQB05VPBPimIL+3vXxaFjQVPKDy6har3aBeIBS31mG/FPk34YD8=;
Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1leboX-0006Rk-7e; Thu, 06 May 2021 13:05:07 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: JD Smith <jdtsmith@HIDDEN>
Subject: Re: bug#47575: python-shell-completion-at-point omits %magic commands
References: <0F56B58F-840F-45EA-B538-02FF19E16A90@HIDDEN>
X-Now-Playing: Nico's _Do Or Die_: "audio_14.mp3"
Date: Thu, 06 May 2021 13:05:04 +0200
In-Reply-To: <0F56B58F-840F-45EA-B538-02FF19E16A90@HIDDEN> (JD Smith's
 message of "Sat, 3 Apr 2021 00:21:54 -0400")
Message-ID: <87a6p8w2an.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 
 Content preview:  JD Smith <jdtsmith@HIDDEN> writes: > When using iPython
    as the inferior shell of python.el, > `python-shell-completion-at-point'
   skips a `simple-operator’ regexp which include > ?%. In iPython, magic commands
    begin with ‘%’, and [...] 
 
 Content analysis details:   (-2.9 points, 5.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
                             [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 47575
Cc: 47575 <at> debbugs.gnu.org, Andrii Kolomoiets <andreyk.mad@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

JD Smith <jdtsmith@HIDDEN> writes:

> When using iPython as the inferior shell of python.el,
> `python-shell-completion-at-point' skips a `simple-operator=E2=80=99 rege=
xp which include
> ?%.  In iPython, magic commands begin with =E2=80=98%=E2=80=99, and the f=
allback completion
> method happily provides them for completion:
>
>  In [67]: __PYTHON_EL_get_completions("%ru")
>  Out[91]: ['%%ruby', '%run=E2=80=99]
>
> python-shell-completion-at-point trims this to =E2=80=9Cru=E2=80=9D, whic=
h also provides the same
> completions above, but which `try-completions=E2=80=99 rejects as non-mat=
ching.   So that:
>
>  In [1]: %ru[Tab]
>
> Leads to =E2=80=9CNo matches=E2=80=9D.
>
> The solution would be to not skip the ?% character if it is at the start =
of the line.  The
> modulo operator cannot occur there in any case.=20

The simple-operator was added to fix bug#37808 in:

commit 51d3c95147efa80fd3e09c90705439517e8fb6ca
Author:     Andrii Kolomoiets <andreyk.mad@HIDDEN>
AuthorDate: Fri Oct 18 16:04:32 2019 +0300

I've added Andrii to the CCs.

--=20
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#47575; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 3 Apr 2021 04:22:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 03 00:22:03 2021
Received: from localhost ([127.0.0.1]:33074 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1lSXnO-0005q4-Tl
	for submit <at> debbugs.gnu.org; Sat, 03 Apr 2021 00:22:03 -0400
Received: from lists.gnu.org ([209.51.188.17]:42054)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jdtsmith@HIDDEN>) id 1lSXnN-0005px-Sr
 for submit <at> debbugs.gnu.org; Sat, 03 Apr 2021 00:22:02 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:59168)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <jdtsmith@HIDDEN>)
 id 1lSXnN-000138-NA
 for bug-gnu-emacs@HIDDEN; Sat, 03 Apr 2021 00:22:01 -0400
Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]:39833)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <jdtsmith@HIDDEN>)
 id 1lSXnL-0007qQ-VH
 for bug-gnu-emacs@HIDDEN; Sat, 03 Apr 2021 00:22:01 -0400
Received: by mail-qk1-x72e.google.com with SMTP id q26so6891061qkm.6
 for <bug-gnu-emacs@HIDDEN>; Fri, 02 Apr 2021 21:21:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:mime-version:subject:message-id:date:to;
 bh=56r5r+pwOwBkywck5e2BIrwxN6pV+6vDif4wIjuvz+k=;
 b=dZPGY0Ln9td5S4S7+NMuXacIUS7G74o7raNL4IHRiOTsxQFbYOIKWHHRQbdW51ulmd
 Fgf29xqvgwER9+K/4pQpKKWRsdm6RNk3x+Pttun0PRj2wN0mfU3X69oVGxjJ62E1Z87V
 pETp5mQh2uSxVumgle6YgwlKHIRJvdOjK4cPEBe1rIWPSaq+1VOG7zFIPz9ZrxKItkyg
 yXksWcp56ztdeser71Whu7rsmMNPN0bcTTrA9+97tnqnuUvt0S8f26/zQ+R36OQ0rcq8
 U5a0dlzsdO4sFJdyqhZF31PG28M56t4Ez17cw1amkrTeI1/jT5JWZsF9wiyVEcjZPTNG
 apjw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:mime-version:subject:message-id:date:to;
 bh=56r5r+pwOwBkywck5e2BIrwxN6pV+6vDif4wIjuvz+k=;
 b=o5z4SdOuXR5Sriw3VRJkk9CUGoisBsmmwOrQku2+ccpavSqJnAhvxzgJgipY32JKyd
 XQno7O1AFfmBImjUzX0HcRXVaXVhGmlteltSxYRyaWMcc/Uhds9fn3eupk6qukDSo4Aj
 NKXP5ziqnspt0uY/vL74zXR6/aGcChA6bYU90k6idMK83zDi8D0fun5JYXUl5YJgXRdp
 FOdawhKK2p3eDv4lSJUZhvoR0baerpZCN3fKdzqqY2j21qsGWLFPBsOmKv9EtLpjrI2S
 bv5kcL6LFyRwIVgncunEzouQXFWe6p+tbN38IG9dTK02DUDNssvU3b9Bq80SS6C8u4hV
 RYDA==
X-Gm-Message-State: AOAM531TTL0j6Y/7kWfKVNEZfVQqMW7/cgOu1Gu5AQdNZMIGsn6nojLB
 3wOpnxUbJ9cMBen+VZAp5ZHVHVweJ65vQQ==
X-Google-Smtp-Source: ABdhPJyUCRxq1Xit6VM+hFa3IEgUG8jprDoMpn0hNxGzRv2hEiFFHhUbay4SCWjgXGWHyuromCv01w==
X-Received: by 2002:a05:620a:553:: with SMTP id
 o19mr16090701qko.491.1617423717985; 
 Fri, 02 Apr 2021 21:21:57 -0700 (PDT)
Received: from [192.168.0.108] (cm-134-228-54-223.buckeyecom.net.
 [134.228.54.223])
 by smtp.gmail.com with ESMTPSA id l16sm8626968qkg.91.2021.04.02.21.21.57
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Fri, 02 Apr 2021 21:21:57 -0700 (PDT)
From: JD Smith <jdtsmith@HIDDEN>
Content-Type: multipart/alternative;
 boundary="Apple-Mail=_D3DF062D-5B74-43B5-93DF-F30EFA51B52A"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\))
Subject: python-shell-completion-at-point omits %magic commands
Message-Id: <0F56B58F-840F-45EA-B538-02FF19E16A90@HIDDEN>
Date: Sat, 3 Apr 2021 00:21:54 -0400
To: bug-gnu-emacs@HIDDEN
X-Mailer: Apple Mail (2.3608.120.23.2.4)
Received-SPF: pass client-ip=2607:f8b0:4864:20::72e;
 envelope-from=jdtsmith@HIDDEN; helo=mail-qk1-x72e.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)


--Apple-Mail=_D3DF062D-5B74-43B5-93DF-F30EFA51B52A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

When using iPython as the inferior shell of python.el, =
`python-shell-completion-at-point' skips a `simple-operator=E2=80=99 =
regexp which include ?%.  In iPython, magic commands begin with =E2=80=98%=
=E2=80=99, and the fallback completion method happily provides them for =
completion:

In [67]: __PYTHON_EL_get_completions("%ru")
Out[91]: ['%%ruby', '%run=E2=80=99]

python-shell-completion-at-point trims this to =E2=80=9Cru=E2=80=9D, =
which also provides the same completions above, but which =
`try-completions=E2=80=99 rejects as non-matching.   So that:

In [1]: %ru[Tab]

Leads to =E2=80=9CNo matches=E2=80=9D.

The solution would be to not skip the ?% character if it is at the start =
of the line.  The modulo operator cannot occur there in any case.=20

One other point: the fallback mechanism sends and compiles the =
relatively long __PYTHON_EL_get_completions function each and every time =
it is called.  Because of how CAPF functions, this actually occurs 3 =
times in quick succession with a single Tab press like the above!  A =
more performant approach (esp. over remote buffer connections) would be =
to just call __PYTHON_EL_get_completions, and check for failure, setting =
up that function again if necessary.  This would parallel the readline =
completer native method, which is only setup once.=20


--Apple-Mail=_D3DF062D-5B74-43B5-93DF-F30EFA51B52A
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html;
	charset=utf-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; =
charset=3Dutf-8"></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; line-break: after-white-space;" class=3D""><div =
class=3D"">When using iPython as the inferior shell of python.el, =
`python-shell-completion-at-point' skips a `simple-operator=E2=80=99 =
regexp which include ?%. &nbsp;In iPython, magic commands begin with =
=E2=80=98%=E2=80=99, and the fallback completion method happily provides =
them for completion:</div><div class=3D""><br class=3D""></div><blockquote=
 style=3D"margin: 0 0 0 40px; border: none; padding: 0px;" class=3D""><div=
 class=3D""><div class=3D"">In [67]: =
__PYTHON_EL_get_completions("%ru")</div></div><div class=3D""><div =
class=3D"">Out[91]: ['%%ruby', '%run=E2=80=99]</div></div></blockquote><di=
v class=3D""><br class=3D""></div><div class=3D""><font color=3D"#000000" =
class=3D"">python-shell-completion-at-point trims this =
to&nbsp;=E2=80=9Cru=E2=80=9D,&nbsp;which also&nbsp;provides the same =
completions above, but which `try-completions=E2=80=99 rejects as =
non-matching. &nbsp; So that:</font></div><div class=3D""><font =
color=3D"#000000" class=3D""><br class=3D""></font></div><blockquote =
style=3D"margin: 0 0 0 40px; border: none; padding: 0px;" class=3D""><div =
class=3D""><font color=3D"#000000" class=3D"">In [1]: =
%ru[Tab]</font></div></blockquote><div class=3D""><font color=3D"#000000" =
class=3D""><br class=3D""></font></div><div class=3D""><font =
color=3D"#000000" class=3D"">Leads to&nbsp;=E2=80=9CNo =
matches=E2=80=9D.</font></div><div class=3D""><font color=3D"#000000" =
class=3D""><br class=3D""></font></div><div class=3D""><span =
style=3D"color: rgb(0, 0, 0);" class=3D"">The solution would be to not =
skip the ?% character if it is at the start of the line. &nbsp;The =
modulo operator cannot occur there in any case.&nbsp;</span></div><div =
class=3D""><font color=3D"#000000" class=3D""><br =
class=3D""></font></div><div class=3D""><font color=3D"#000000" =
class=3D"">One other point: the fallback mechanism sends and compiles =
the relatively long __PYTHON_EL_get_completions function each and every =
time it is called. &nbsp;Because of how CAPF functions, this actually =
occurs 3 times in quick succession with a single Tab press like the =
above! &nbsp;A more performant approach (esp. over remote buffer =
connections)&nbsp;would be to just =
call&nbsp;__PYTHON_EL_get_completions, and check for failure, setting up =
that function again if necessary. &nbsp;This&nbsp;would parallel the =
readline&nbsp;completer native method,&nbsp;which is only setup =
once.&nbsp;</font></div><div class=3D""><br =
class=3D""></div></body></html>=

--Apple-Mail=_D3DF062D-5B74-43B5-93DF-F30EFA51B52A--




Acknowledgement sent to JD Smith <jdtsmith@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#47575; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 6 May 2021 11:15:01 UTC

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