diff options
author | kobarity <kobarity@gmail.com> | 2022-10-12 13:14:33 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2022-10-12 13:14:33 +0200 |
commit | aa559c15537a59147bb01617b4a1f9eee20af3a1 (patch) | |
tree | 0de92d6d2764117965419112246cc4f6d2e15bde /lisp/progmodes/python.el | |
parent | 2953d89d74ebfe6a6bcbe0d25a60a845acad0e13 (diff) | |
download | emacs-aa559c15537a59147bb01617b4a1f9eee20af3a1.tar.gz emacs-aa559c15537a59147bb01617b4a1f9eee20af3a1.tar.bz2 emacs-aa559c15537a59147bb01617b4a1f9eee20af3a1.zip |
Fix Python completion when point in shell buffer is before prompt
* lisp/progmodes/python.el (python-shell-completion-at-point): Limit
prompt boundaries check to shell buffer.
* test/lisp/progmodes/python-tests.el (python-shell-completion-2):
(python-shell-completion-native-2): New tests (bug#58441).
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r-- | lisp/progmodes/python.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 680b57fc3ef..0de76b0bde3 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -4069,7 +4069,8 @@ With argument MSG show activation/deactivation message." Optional argument PROCESS forces completions to be retrieved using that one instead of current buffer's process." (setq process (or process (get-buffer-process (current-buffer)))) - (let* ((line-start (if (derived-mode-p 'inferior-python-mode) + (let* ((is-shell-buffer (derived-mode-p 'inferior-python-mode)) + (line-start (if is-shell-buffer ;; Working on a shell buffer: use prompt end. (cdr (python-util-comint-last-prompt)) (line-beginning-position))) @@ -4100,7 +4101,8 @@ using that one instead of current buffer's process." (completion-fn (with-current-buffer (process-buffer process) (cond ((or (null prompt) - (< (point) (cdr prompt-boundaries))) + (and is-shell-buffer + (< (point) (cdr prompt-boundaries)))) #'ignore) ((or (not python-shell-completion-native-enable) ;; Even if native completion is enabled, for |