From: JD Smith <jdtsmith@gmail.com>
To: 47575@debbugs.gnu.org
Subject: bug#47575: python-shell-completion-at-point omits %magic commands
Date: Sat, 3 Apr 2021 00:21:54 -0400 [thread overview]
Message-ID: <0F56B58F-840F-45EA-B538-02FF19E16A90@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1257 bytes --]
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.
[-- Attachment #2: Type: text/html, Size: 2481 bytes --]
next reply other threads:[~2021-04-03 4:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-03 4:21 JD Smith [this message]
2021-05-06 11:05 ` bug#47575: python-shell-completion-at-point omits %magic commands Lars Ingebrigtsen
2021-05-06 13:38 ` Andrii Kolomoiets
2022-06-29 10:46 ` Lars Ingebrigtsen
2022-06-29 20:31 ` Andrii Kolomoiets
2022-06-30 10:06 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0F56B58F-840F-45EA-B538-02FF19E16A90@gmail.com \
--to=jdtsmith@gmail.com \
--cc=47575@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.