aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2012-05-17 00:03:25 -0300
committerFabián Ezequiel Gallina2012-05-17 00:03:25 -0300
commit1faf2911d613ac1c208e7ffca52e484804d3b0bb (patch)
tree264aed674020ccee7aaf1543045eba9e905dbb05
parenta0686d71f63440b119bcf671eea7409f2476bef9 (diff)
downloademacs-1faf2911d613ac1c208e7ffca52e484804d3b0bb.tar.gz
emacs-1faf2911d613ac1c208e7ffca52e484804d3b0bb.zip
Enhancements to python-shell-send-string-no-output to work OK with iPython 0.11
Also the documentation has been updated with info to make iPython 0.11 and 0.10 work with python.el's shell integration.
-rw-r--r--lisp/progmodes/python.el34
1 files changed, 16 insertions, 18 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 53bb9939dee..fe026a8da1a 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -68,7 +68,7 @@
68;; `python-shell-completion-string-code'. 68;; `python-shell-completion-string-code'.
69 69
70;; Here is a complete example of the settings you would use for 70;; Here is a complete example of the settings you would use for
71;; iPython 71;; iPython 0.11:
72 72
73;; (setq 73;; (setq
74;; python-shell-interpreter "ipython" 74;; python-shell-interpreter "ipython"
@@ -77,7 +77,13 @@
77;; python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: " 77;; python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
78;; python-shell-completion-setup-code "" 78;; python-shell-completion-setup-code ""
79;; python-shell-completion-string-code 79;; python-shell-completion-string-code
80;; "';'.join(__IP.complete('''%s'''))\n") 80;; "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
81
82;; For iPython 0.10 everything would be the same except for
83;; `python-shell-completion-string-code':
84
85;; (setq python-shell-completion-string-code
86;; "';'.join(__IP.complete('''%s'''))\n")
81 87
82;; Please note that the default completion system depends on the 88;; Please note that the default completion system depends on the
83;; readline module, so if you are using some Operating System that 89;; readline module, so if you are using some Operating System that
@@ -1393,24 +1399,16 @@ the output."
1393 ""))))) 1399 "")))))
1394 (python-shell-send-string string process msg) 1400 (python-shell-send-string string process msg)
1395 (accept-process-output process) 1401 (accept-process-output process)
1396 ;; Cleanup output prompt regexp
1397 (when (and (not (string= "" output-buffer))
1398 (> (length python-shell-prompt-output-regexp) 0))
1399 (setq output-buffer
1400 (with-temp-buffer
1401 (insert output-buffer)
1402 (goto-char (point-min))
1403 (forward-comment 9999)
1404 (buffer-substring-no-properties
1405 (or
1406 (and (looking-at python-shell-prompt-output-regexp)
1407 (re-search-forward
1408 python-shell-prompt-output-regexp nil t 1))
1409 (point-marker))
1410 (point-max)))))
1411 (mapconcat 1402 (mapconcat
1412 (lambda (string) string) 1403 (lambda (string) string)
1413 (butlast (split-string output-buffer "\n")) "\n"))) 1404 (split-string
1405 output-buffer
1406 (if (> (length python-shell-prompt-output-regexp) 0)
1407 (format "\n*%s$\\|^%s"
1408 python-shell-prompt-regexp
1409 (or python-shell-prompt-output-regexp ""))
1410 (format "\n$\\|^%s"
1411 python-shell-prompt-regexp)) t) "\n")))
1414 1412
1415(defun python-shell-internal-send-string (string) 1413(defun python-shell-internal-send-string (string)
1416 "Send STRING to the Internal Python interpreter. 1414 "Send STRING to the Internal Python interpreter.