diff options
| author | Dan Davison | 2012-05-17 00:03:38 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-05-17 00:03:38 -0300 |
| commit | 53df7818c0d296953333efceefcdde6cba51cfcf (patch) | |
| tree | c2833094f680b359bd01ef095530939440ef6df8 | |
| parent | 936bc8333f08546722a7f9ca2640488e797c39de (diff) | |
| download | emacs-53df7818c0d296953333efceefcdde6cba51cfcf.tar.gz emacs-53df7818c0d296953333efceefcdde6cba51cfcf.zip | |
Pass entire line of input to module completer
The module completer wants e.g. 'from xxx' as input, not just 'xxx'.
This change also causes all modules to be offered as completions to
'from ', whereas previously this was regarded as empty input.
| -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 |