diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 6c11a478942..f6e1021c86a 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -2888,31 +2888,30 @@ the full statement in the case of imports." | |||
| 2888 | "Do completion at point using PROCESS for IMPORT or INPUT. | 2888 | "Do completion at point using PROCESS for IMPORT or INPUT. |
| 2889 | When IMPORT is non-nil takes precedence over INPUT for | 2889 | When IMPORT is non-nil takes precedence over INPUT for |
| 2890 | completion." | 2890 | completion." |
| 2891 | (let* ((prompt | 2891 | (with-current-buffer (process-buffer process) |
| 2892 | (with-current-buffer (process-buffer process) | 2892 | (let* ((prompt |
| 2893 | (let ((prompt-boundaries (python-util-comint-last-prompt))) | 2893 | (let ((prompt-boundaries (python-util-comint-last-prompt))) |
| 2894 | (buffer-substring-no-properties | 2894 | (buffer-substring-no-properties |
| 2895 | (car prompt-boundaries) (cdr prompt-boundaries))))) | 2895 | (car prompt-boundaries) (cdr prompt-boundaries)))) |
| 2896 | (completion-code | 2896 | (completion-code |
| 2897 | ;; Check whether a prompt matches a pdb string, an import | 2897 | ;; Check whether a prompt matches a pdb string, an import |
| 2898 | ;; statement or just the standard prompt and use the | 2898 | ;; statement or just the standard prompt and use the |
| 2899 | ;; correct python-shell-completion-*-code string | 2899 | ;; correct python-shell-completion-*-code string |
| 2900 | (cond ((and (string-match | 2900 | (cond ((and (string-match |
| 2901 | (concat "^" python-shell-prompt-pdb-regexp) prompt)) | 2901 | (concat "^" python-shell-prompt-pdb-regexp) prompt)) |
| 2902 | ;; Since there are no guarantees the user will remain | 2902 | ;; Since there are no guarantees the user will remain |
| 2903 | ;; in the same context where completion code was sent | 2903 | ;; in the same context where completion code was sent |
| 2904 | ;; (e.g. user steps into a function), safeguard | 2904 | ;; (e.g. user steps into a function), safeguard |
| 2905 | ;; resending completion setup continuously. | 2905 | ;; resending completion setup continuously. |
| 2906 | (concat python-shell-completion-setup-code | 2906 | (concat python-shell-completion-setup-code |
| 2907 | "\nprint (" python-shell-completion-string-code ")")) | 2907 | "\nprint (" python-shell-completion-string-code ")")) |
| 2908 | ((string-match | 2908 | ((string-match |
| 2909 | python-shell--prompt-calculated-input-regexp prompt) | 2909 | python-shell--prompt-calculated-input-regexp prompt) |
| 2910 | python-shell-completion-string-code) | 2910 | python-shell-completion-string-code) |
| 2911 | (t nil))) | 2911 | (t nil))) |
| 2912 | (subject (or import input))) | 2912 | (subject (or import input))) |
| 2913 | (and completion-code | 2913 | (and completion-code |
| 2914 | (> (length input) 0) | 2914 | (> (length input) 0) |
| 2915 | (with-current-buffer (process-buffer process) | ||
| 2916 | (let ((completions | 2915 | (let ((completions |
| 2917 | (python-util-strip-string | 2916 | (python-util-strip-string |
| 2918 | (python-shell-send-string-no-output | 2917 | (python-shell-send-string-no-output |