mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-24 13:32:41 -08:00
Improve non-native completion in Python mode
Previously, both the definition of __PYTHON_EL_get_completions and the call to __PYTHON_EL_get_completions were sent to the inferior Python each time 'python-shell-completion-get-completions' was executed. However, there is no need to send the definition every time as long as the definition remains unchanged. We improved this so that the definition of __PYTHON_EL_get_completions is only sent during the inferior Python initialization; it is no longer sent during 'python-shell-completion-get-completions' execution. * lisp/progmodes/python.el (python-shell-completion-send-setup-code): New function. (python-shell-first-prompt-hook): Add the above new function. (python-shell-completion-get-completions): Omit sending 'python-shell-completion-setup-code'. (Bug#80182)
This commit is contained in:
parent
6e37af1fe8
commit
c97b8e6650
1 changed files with 8 additions and 2 deletions
|
|
@ -4514,6 +4514,13 @@ def __PYTHON_EL_get_completions(text):
|
|||
"Code used to setup completion in inferior Python processes."
|
||||
:type 'string)
|
||||
|
||||
(defun python-shell-completion-send-setup-code ()
|
||||
"Send `python-shell-completion-setup-code' to inferior Python process."
|
||||
(python-shell-send-string-no-output python-shell-completion-setup-code))
|
||||
|
||||
(add-hook 'python-shell-first-prompt-hook
|
||||
#'python-shell-completion-send-setup-code)
|
||||
|
||||
(define-obsolete-variable-alias
|
||||
'python-shell-completion-module-string-code
|
||||
'python-shell-completion-string-code
|
||||
|
|
@ -4844,8 +4851,7 @@ With argument MSG show activation/deactivation message."
|
|||
(with-current-buffer (process-buffer process)
|
||||
(let ((completions
|
||||
(python-shell-send-string-no-output
|
||||
(format "%s\nprint(__PYTHON_EL_get_completions(%s))"
|
||||
python-shell-completion-setup-code
|
||||
(format "print(__PYTHON_EL_get_completions(%s))"
|
||||
(python-shell--encode-string input))
|
||||
process)))
|
||||
(condition-case nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue