Skip to content

Instantly share code, notes, and snippets.

@ihodes
Last active August 29, 2015 14:00
Show Gist options
  • Save ihodes/11444387 to your computer and use it in GitHub Desktop.
Save ihodes/11444387 to your computer and use it in GitHub Desktop.
;;; python-settings
;;; requires modes: ein python jedi
;; if not in ipython notebook mode allows sending to ipython server from buffer (C-c C-c)
;; (switch to shell with C-c C-z)
(setq
python-shell-interpreter "ipython"
python-shell-interpreter-args "--gui=osx --matplotlib=osx --colors=Linux"
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")
;; when first running, M-x jedi:install-server
(add-hook 'python-mode-hook 'jedi:setup)
(setq jedi:complete-on-dot t)
(setq ein:use-auto-complete 1)
(setq ein:console-args '("--gui=osx" "--matplotlib=osx" "--colors=Linux"))
;; run this to easily connect to notebook list (after starting the notebook server: ipython notebook)
(defun ein:load-notebooks ()
(ein:notebooklist-load)
(interactive)
(ein:notebooklist-open))
;;;; NOTE: you've gotta comment out an important (?) line in zmq:
;;;; in /usr/local/lib/python2.7/site-packages/IPython/html/base/zmqhandlers.py
;;;;; line 112-114 -- remove the fail on not same origin, as this is a bug with ipython or this plugin (doesn't set the Origin header correctly) which crashes the websocket
(provide 'python-settings)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment