aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el27
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)