diff options
| -rw-r--r-- | lisp/progmodes/python.el | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index b87ab57c66f..b1d52926ec0 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1750,24 +1750,32 @@ completions on the current context." | |||
| 1750 | (buffer-substring-no-properties | 1750 | (buffer-substring-no-properties |
| 1751 | (overlay-start comint-last-prompt-overlay) | 1751 | (overlay-start comint-last-prompt-overlay) |
| 1752 | (overlay-end comint-last-prompt-overlay)))) | 1752 | (overlay-end comint-last-prompt-overlay)))) |
| 1753 | (completion-code | 1753 | (completion-context |
| 1754 | ;; Check wether a prompt matches a pdb string, an import statement | 1754 | ;; Check wether a prompt matches a pdb string, an import statement |
| 1755 | ;; or just the standard prompt and use the correct | 1755 | ;; or just the standard prompt and use the correct |
| 1756 | ;; python-shell-completion-*-code string | 1756 | ;; python-shell-completion-*-code string |
| 1757 | (cond ((and (> (length python-shell-completion-pdb-string-code) 0) | 1757 | (cond ((and (> (length python-shell-completion-pdb-string-code) 0) |
| 1758 | (string-match | 1758 | (string-match |
| 1759 | (concat "^" python-shell-prompt-pdb-regexp) prompt)) | 1759 | (concat "^" python-shell-prompt-pdb-regexp) prompt)) |
| 1760 | python-shell-completion-pdb-string-code) | 1760 | 'pdb) |
| 1761 | ((and (> | 1761 | ((and (> |
| 1762 | (length python-shell-completion-module-string-code) 0) | 1762 | (length python-shell-completion-module-string-code) 0) |
| 1763 | (string-match | 1763 | (string-match |
| 1764 | (concat "^" python-shell-prompt-regexp) prompt) | 1764 | (concat "^" python-shell-prompt-regexp) prompt) |
| 1765 | (string-match "^\\(from\\|import\\)[ \t]" line)) | 1765 | (string-match "^\\(from\\|import\\)[ \t]" line)) |
| 1766 | python-shell-completion-module-string-code) | 1766 | 'import) |
| 1767 | ((string-match | 1767 | ((string-match |
| 1768 | (concat "^" python-shell-prompt-regexp) prompt) | 1768 | (concat "^" python-shell-prompt-regexp) prompt) |
| 1769 | python-shell-completion-string-code) | 1769 | 'default) |
| 1770 | (t nil))) | 1770 | (t nil))) |
| 1771 | (completion-code | ||
| 1772 | (case completion-context | ||
| 1773 | ('pdb python-shell-completion-pdb-string-code) | ||
| 1774 | ('import python-shell-completion-module-string-code) | ||
| 1775 | ('default python-shell-completion-string-code) | ||
| 1776 | (t nil))) | ||
| 1777 | (input | ||
| 1778 | (if (eq completion-context 'import) line input)) | ||
| 1771 | (completions | 1779 | (completions |
| 1772 | (and completion-code (> (length input) 0) | 1780 | (and completion-code (> (length input) 0) |
| 1773 | (python-shell-completion--get-completions | 1781 | (python-shell-completion--get-completions |