GNU bug report logs -
#47575
python-shell-completion-at-point omits %magic commands
Previous Next
To reply to this bug, email your comments to 47575 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#47575
; Package
emacs
.
(Sat, 03 Apr 2021 04:23:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
JD Smith <jdtsmith <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 03 Apr 2021 04:23:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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 the fallback completion method happily provides them for completion:
In [67]: __PYTHON_EL_get_completions("%ru")
Out[91]: ['%%ruby', '%run’]
python-shell-completion-at-point trims this to “ru”, which also provides the same completions above, but which `try-completions’ rejects as non-matching. So that:
In [1]: %ru[Tab]
Leads to “No matches”.
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.
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.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#47575
; Package
emacs
.
(Thu, 06 May 2021 11:06:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 47575 <at> debbugs.gnu.org (full text, mbox):
JD Smith <jdtsmith <at> gmail.com> 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 the fallback completion
> method happily provides them for completion:
>
> In [67]: __PYTHON_EL_get_completions("%ru")
> Out[91]: ['%%ruby', '%run’]
>
> python-shell-completion-at-point trims this to “ru”, which also provides the same
> completions above, but which `try-completions’ rejects as non-matching. So that:
>
> In [1]: %ru[Tab]
>
> Leads to “No matches”.
>
> 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.
The simple-operator was added to fix bug#37808 in:
commit 51d3c95147efa80fd3e09c90705439517e8fb6ca
Author: Andrii Kolomoiets <andreyk.mad <at> gmail.com>
AuthorDate: Fri Oct 18 16:04:32 2019 +0300
I've added Andrii to the CCs.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#47575
; Package
emacs
.
(Thu, 06 May 2021 13:40:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 47575 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> JD Smith <jdtsmith <at> gmail.com> writes:
>
>> 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.
Well :)
>>> foo=1
>>> bar=2
>>> foo\
... %bar
1
Though I don't think it's the common use case.
--
Andrii
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#47575
; Package
emacs
.
(Wed, 29 Jun 2022 10:47:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 47575 <at> debbugs.gnu.org (full text, mbox):
Andrii Kolomoiets <andreyk.mad <at> gmail.com> writes:
>>> 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.
>
> Well :)
>
> >>> foo=1
> >>> bar=2
> >>> foo\
> ... %bar
> 1
>
> Though I don't think it's the common use case.
It does sounds very unlikely, so should JD's suggestion be implemented?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#47575
; Package
emacs
.
(Wed, 29 Jun 2022 20:33:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 47575 <at> debbugs.gnu.org (full text, mbox):
Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>>>> modulo operator cannot occur there in any case.
>> ... %bar
>> 1
>>
>> Though I don't think it's the common use case.
>
> It does sounds very unlikely, so should JD's suggestion be implemented?
Agree, sounds good.
--
Andrii
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#47575
; Package
emacs
.
(Thu, 30 Jun 2022 10:07:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 47575 <at> debbugs.gnu.org (full text, mbox):
Andrii Kolomoiets <andreyk.mad <at> gmail.com> writes:
>>>>> modulo operator cannot occur there in any case.
>>> ... %bar
>>> 1
>>>
>>> Though I don't think it's the common use case.
>>
>> It does sounds very unlikely, so should JD's suggestion be implemented?
>
> Agree, sounds good.
I'm really not that familiar with python-mode -- can anybody suggest a
patch here? (The code is question is in
python-shell-completion-at-point.)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 2 years and 353 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.