GNU bug report logs -
#47575
python-shell-completion-at-point omits %magic commands
Previous Next
Full log
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)]
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.