aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/python.el13
1 files changed, 6 insertions, 7 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 72df547d760..52c9b628b4f 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1601,8 +1601,7 @@ else:
1601 :safe 'stringp) 1601 :safe 'stringp)
1602 1602
1603(defcustom python-shell-module-completion-string-code "" 1603(defcustom python-shell-module-completion-string-code ""
1604 "Python code used to get a string of completions separated by 1604 "Python code used to get completions separated by semicolons for imports.
1605 semicolons on a module import line.
1606 1605
1607For IPython v0.11, add the following line to 1606For IPython v0.11, add the following line to
1608`python-shell-completion-setup-code': 1607`python-shell-completion-setup-code':
@@ -1616,10 +1615,10 @@ and use the following as the value of this variable:
1616 :group 'python 1615 :group 'python
1617 :safe 'stringp) 1616 :safe 'stringp)
1618 1617
1619(defvar python-shell-import-line-regexp "^\\(from\\|import\\)[ \t]")
1620
1621(defun python-shell-completion--get-completions (input process completion-code) 1618(defun python-shell-completion--get-completions (input process completion-code)
1622 "Retrieve available completions for INPUT using PROCESS." 1619 "Retrieve available completions for INPUT using PROCESS.
1620Argument COMPLETION-CODE is the python code used to get
1621completions on the current context."
1623 (with-current-buffer (process-buffer process) 1622 (with-current-buffer (process-buffer process)
1624 (let ((completions (python-shell-send-string-no-output 1623 (let ((completions (python-shell-send-string-no-output
1625 (format completion-code input) process))) 1624 (format completion-code input) process)))
@@ -1627,7 +1626,7 @@ and use the following as the value of this variable:
1627 (split-string completions "^'\\|^\"\\|;\\|'$\\|\"$" t))))) 1626 (split-string completions "^'\\|^\"\\|;\\|'$\\|\"$" t)))))
1628 1627
1629(defun python-shell-completion--do-completion-at-point (process) 1628(defun python-shell-completion--do-completion-at-point (process)
1630 "Do completion for INPUT using COMPLETIONS." 1629 "Do completion at point for PROCESS."
1631 (with-syntax-table python-dotty-syntax-table 1630 (with-syntax-table python-dotty-syntax-table
1632 (let* ((line (substring-no-properties 1631 (let* ((line (substring-no-properties
1633 (buffer-substring (point-at-bol) (point)) nil nil)) 1632 (buffer-substring (point-at-bol) (point)) nil nil))
@@ -1635,7 +1634,7 @@ and use the following as the value of this variable:
1635 (or (comint-word (current-word)) "") nil nil)) 1634 (or (comint-word (current-word)) "") nil nil))
1636 (completions 1635 (completions
1637 (if (and (> (length python-shell-module-completion-string-code) 0) 1636 (if (and (> (length python-shell-module-completion-string-code) 0)
1638 (string-match python-shell-import-line-regexp line)) 1637 (string-match "^\\(from\\|import\\)[ \t]" line))
1639 (python-shell-completion--get-completions 1638 (python-shell-completion--get-completions
1640 line process python-shell-module-completion-string-code) 1639 line process python-shell-module-completion-string-code)
1641 (python-shell-completion--get-completions 1640 (python-shell-completion--get-completions