diff options
| author | Fabián Ezequiel Gallina | 2012-05-17 00:03:31 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-05-17 00:03:31 -0300 |
| commit | aa4099353c10e0af0bbc11ca56a8be6243b3c882 (patch) | |
| tree | e5fb77de2f3b142352de5aa53b8e04278f36e1c7 /lisp/progmodes/python.el | |
| parent | 76a9ea3bbb02add4edca960f0314a42e85e0069a (diff) | |
| download | emacs-aa4099353c10e0af0bbc11ca56a8be6243b3c882.tar.gz emacs-aa4099353c10e0af0bbc11ca56a8be6243b3c882.zip | |
Improved completion support when in [i]pdb
`python-shell-completion--do-completion-at-point' has been modified in
order to support different completion contexts easily.
New vars:
+ python-shell-completion-pdb-string-code
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 401d9fd0495..b4d388eb41d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1609,6 +1609,13 @@ and use the following as the value of this variable: | |||
| 1609 | :group 'python | 1609 | :group 'python |
| 1610 | :safe 'stringp) | 1610 | :safe 'stringp) |
| 1611 | 1611 | ||
| 1612 | (defcustom python-shell-completion-pdb-string-code | ||
| 1613 | "';'.join(globals().keys() + locals().keys())" | ||
| 1614 | "Python code used to get completions separated by semicolons for [i]pdb." | ||
| 1615 | :type 'string | ||
| 1616 | :group 'python | ||
| 1617 | :safe 'stringp) | ||
| 1618 | |||
| 1612 | (defvar python-shell-completion-original-window-configuration nil) | 1619 | (defvar python-shell-completion-original-window-configuration nil) |
| 1613 | 1620 | ||
| 1614 | (defun python-shell-completion--get-completions (input process completion-code) | 1621 | (defun python-shell-completion--get-completions (input process completion-code) |
| @@ -1628,14 +1635,20 @@ completions on the current context." | |||
| 1628 | (buffer-substring (point-at-bol) (point)) nil nil)) | 1635 | (buffer-substring (point-at-bol) (point)) nil nil)) |
| 1629 | (input (substring-no-properties | 1636 | (input (substring-no-properties |
| 1630 | (or (comint-word (current-word)) "") nil nil)) | 1637 | (or (comint-word (current-word)) "") nil nil)) |
| 1631 | (completions | 1638 | (completion-code |
| 1632 | (if (and (> (length python-shell-completion-module-string-code) 0) | 1639 | (cond ((and (> (length python-shell-completion-pdb-string-code) 0) |
| 1640 | (string-match python-shell-prompt-pdb-regexp | ||
| 1641 | (buffer-substring-no-properties | ||
| 1642 | (overlay-start comint-last-prompt-overlay) | ||
| 1643 | (overlay-end comint-last-prompt-overlay)))) | ||
| 1644 | python-shell-completion-pdb-string-code) | ||
| 1645 | ((and (> (length python-shell-completion-module-string-code) 0) | ||
| 1633 | (string-match "^\\(from\\|import\\)[ \t]" line)) | 1646 | (string-match "^\\(from\\|import\\)[ \t]" line)) |
| 1634 | (python-shell-completion--get-completions | 1647 | python-shell-completion-module-string-code) |
| 1635 | line process python-shell-completion-module-string-code) | 1648 | (t python-shell-completion-string-code))) |
| 1636 | (and (> (length input) 0) | 1649 | (completions |
| 1637 | (python-shell-completion--get-completions | 1650 | (and (> (length input) 0) |
| 1638 | input process python-shell-completion-string-code)))) | 1651 | (python-shell-completion--get-completions line process completion-code))) |
| 1639 | (completion (when completions | 1652 | (completion (when completions |
| 1640 | (try-completion input completions)))) | 1653 | (try-completion input completions)))) |
| 1641 | (cond ((eq completion t) | 1654 | (cond ((eq completion t) |