diff options
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ravi-init-python.el | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/lisp/ravi-init-python.el b/lisp/ravi-init-python.el index 70118f7..100b448 100644 --- a/lisp/ravi-init-python.el +++ b/lisp/ravi-init-python.el @@ -31,8 +31,9 @@ (progn (add-hook 'python-mode-hook 'ravi/python-mode-hook) - (defun ravi/python-mode-hook() - ;; Set ipython as our interpreter + + (defun ravi/old-ipython-setup () + "Set up ipython interpreter for version less than 4, which works with readline" (setq python-shell-interpreter "ipython" python-shell-interpreter-args "--pylab" python-shell-prompt-regexp "In \\[[0-9]+\\]: " @@ -43,13 +44,23 @@ "';'.join(module_completion('''%s'''))\n" python-shell-completion-string-code "';'.join(get_ipython().Completer.all_completions('''%s'''))\n" - ) - - ;; For ipython 0.10, uncomment the following: - ;; (setq python-shell-completion-string-code - ;; "';'.join(__IP.complete('''%s'''))\n" - ;; python-shell-completion-module-string-code "" - ;; ) + )) + (defun ravi/ipython-5p4plus-setup () + "Set up ipython interpreter for version 5.4+ which requires rlipython to be installed" + (setq python-shell-interpreter "ipython" + python-shell-interpreter-args "--pylab --TerminalIPythonApp.interactive_shell_class=rlipython.TerminalInteractiveShell" + 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" + )) + (defun ravi/python-mode-hook() + ;; Set ipython as our interpreter + (ravi/old-ipython-setup) (when (functionp 'helm-dash) (setq-local helm-dash-docsets '("Python 2" "NumPy"))) |
