]> git.eshelyaron.com Git - emacs.git/commitdiff
Pass entire line of input to module completer
authorDan Davison <dandavison7@gmail.com>
Thu, 17 May 2012 03:03:38 +0000 (00:03 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Thu, 17 May 2012 03:03:38 +0000 (00:03 -0300)
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.

lisp/progmodes/python.el

index b87ab57c66fcdd915ac9c859383cc5e1083c88cf..b1d52926ec0f2b18484c49ceefe1348614baaab0 100644 (file)
@@ -1750,24 +1750,32 @@ completions on the current context."
               (buffer-substring-no-properties
                (overlay-start comint-last-prompt-overlay)
                (overlay-end comint-last-prompt-overlay))))
-           (completion-code
+           (completion-context
             ;; Check wether a prompt matches a pdb string, an import statement
             ;; or just the standard prompt and use the correct
             ;; python-shell-completion-*-code string
             (cond ((and (> (length python-shell-completion-pdb-string-code) 0)
                         (string-match
                          (concat "^" python-shell-prompt-pdb-regexp) prompt))
-                   python-shell-completion-pdb-string-code)
+                   'pdb)
                   ((and (>
                          (length python-shell-completion-module-string-code) 0)
                         (string-match
                          (concat "^" python-shell-prompt-regexp) prompt)
                         (string-match "^\\(from\\|import\\)[ \t]" line))
-                   python-shell-completion-module-string-code)
+                   'import)
                   ((string-match
                     (concat "^" python-shell-prompt-regexp) prompt)
-                   python-shell-completion-string-code)
+                   'default)
                   (t nil)))
+          (completion-code
+           (case completion-context
+             ('pdb python-shell-completion-pdb-string-code)
+             ('import python-shell-completion-module-string-code)
+             ('default python-shell-completion-string-code)
+             (t nil)))
+          (input
+           (if (eq completion-context 'import) line input))
            (completions
             (and completion-code (> (length input) 0)
                  (python-shell-completion--get-completions