summaryrefslogtreecommitdiff
path: root/lisp/init-python.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-03-14 23:40:41 -0400
committerKyle Meyer <kyle@kyleam.com>2015-03-14 23:40:41 -0400
commite50929e0331ad630a9be153a5b1cd86c2ae68490 (patch)
treeeaa5f1697f6a10ca3c125db34478fb36edbbcd2f /lisp/init-python.el
parentea518db86fe5fef3493009dd820facbed60b5ba1 (diff)
downloademacs.d-e50929e0331ad630a9be153a5b1cd86c2ae68490.tar.gz
Simplify IPython shell setup
Current python.el seems to have this built in.
Diffstat (limited to 'lisp/init-python.el')
-rw-r--r--lisp/init-python.el18
1 files changed, 6 insertions, 12 deletions
diff --git a/lisp/init-python.el b/lisp/init-python.el
index 0b2c471..2eb4325 100644
--- a/lisp/init-python.el
+++ b/lisp/init-python.el
@@ -3,6 +3,8 @@
(setq jedi:tooltip-method nil
ac-auto-start nil)
+(setq python-shell-interpreter "ipython")
+
(add-to-list 'interpreter-mode-alist '("python2" . python-mode))
(add-to-list 'interpreter-mode-alist '("python3" . python-mode))
@@ -15,19 +17,11 @@
(set (make-local-variable 'compile-command) "py.test"))
(add-hook 'python-mode-hook 'km/python-hook)
-;; http://www.emacswiki.org/emacs/PythonProgrammingInEmacs#toc5
-(defun km/setup-ipython-shell ()
+(defun km/toggle-ipython-shell ()
+ "Switch between using python and IPython for interactive shell."
(interactive)
- (setq python-shell-interpreter "ipython"
- python-shell-interpreter-args ""
- python-shell-prompt-regexp "In \\[[0-9]+\\]: "
- python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
- python-shell-completion-setup-code
- "from IPython.core.completerlib import module_completion"
- python-shell-completion-module-string-code
- "';'.join(module_completion('''%s'''))\n"
- python-shell-completion-string-code
- "';'.join(get_ipython().Completer.all_completions('''%s'''))\n"))
+ (setq python-shell-interpreter
+ (if (string= python-shell-interpreter "python") "ipython" "python")))
(defun km/find-python-test-file-other-window (arg)
"Open test file for the current Python file in another window.