all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#47575: python-shell-completion-at-point omits %magic commands
@ 2021-04-03  4:21 JD Smith
  2021-05-06 11:05 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: JD Smith @ 2021-04-03  4:21 UTC (permalink / raw)
  To: 47575

[-- 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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-06-30 10:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-03  4:21 bug#47575: python-shell-completion-at-point omits %magic commands JD Smith
2021-05-06 11:05 ` 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

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.