diff options
| author | Dan Davison | 2012-05-17 00:03:39 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-05-17 00:03:39 -0300 |
| commit | 39806de381d46f62c3bef1736a969b86015bf603 (patch) | |
| tree | 923f317119218a2229ad927e2b72a7af3af90e74 /lisp/progmodes/python.el | |
| parent | bdfb840ec4a5ed475c28de381447f6f1e541d5d1 (diff) | |
| download | emacs-39806de381d46f62c3bef1736a969b86015bf603.tar.gz emacs-39806de381d46f62c3bef1736a969b86015bf603.zip | |
Disregard leading whitespace when forming module completions
This allows an indented import line (e.g. in a function or method
body) to be completed.
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 a10e71dab78..59802cca623 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1761,7 +1761,7 @@ completions on the current context." | |||
| 1761 | (length python-shell-completion-module-string-code) 0) | 1761 | (length python-shell-completion-module-string-code) 0) |
| 1762 | (string-match | 1762 | (string-match |
| 1763 | (concat "^" python-shell-prompt-regexp) prompt) | 1763 | (concat "^" python-shell-prompt-regexp) prompt) |
| 1764 | (string-match "^\\(from\\|import\\)[ \t]" line)) | 1764 | (string-match "^[ \t]*\\(from\\|import\\)[ \t]" line)) |
| 1765 | 'import) | 1765 | 'import) |
| 1766 | ((string-match | 1766 | ((string-match |
| 1767 | (concat "^" python-shell-prompt-regexp) prompt) | 1767 | (concat "^" python-shell-prompt-regexp) prompt) |
| @@ -1774,7 +1774,9 @@ completions on the current context." | |||
| 1774 | ('default python-shell-completion-string-code) | 1774 | ('default python-shell-completion-string-code) |
| 1775 | (t nil))) | 1775 | (t nil))) |
| 1776 | (input | 1776 | (input |
| 1777 | (if (eq completion-context 'import) line input)) | 1777 | (if (eq completion-context 'import) |
| 1778 | (replace-regexp-in-string "^[ \t]+" "" line) | ||
| 1779 | input)) | ||
| 1778 | (completions | 1780 | (completions |
| 1779 | (and completion-code (> (length input) 0) | 1781 | (and completion-code (> (length input) 0) |
| 1780 | (python-shell-completion--get-completions | 1782 | (python-shell-completion--get-completions |