Skip to content
This repository has been archived by the owner on Mar 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #71 from dandavison/fix_module_completion
Browse files Browse the repository at this point in the history
Pass entire line of input to module completer
  • Loading branch information
fgallina committed Mar 19, 2012
2 parents cbac038 + 7716605 commit bcba693
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions python.el
Expand Up @@ -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
Expand Down

0 comments on commit bcba693

Please sign in to comment.