   (defun python-setup-shell ()
     (if (executable-find "ipython")
         (progn
-          (setq python-shell-interpreter "ipython")
-          (when (version< emacs-version "24.4")
-            ;; these settings are unnecessary and even counter-productive on emacs 24.4 and newer
-            (setq 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 "ipython"))
       (setq python-shell-interpreter "python")))
   :config
   (unbreak-stupid-map python-mode-map)

  :init
  ;; (unbind-key "C-<up>" ein:notebook-mode-map)
  ;; (unbind-key "C-<down>" ein:notebook-mode-map)
  :config
  (add-hook 'ein:connect-mode-hook #'ein:jedi-setup)
  ;; (bind-keys :map ein:notebook-mode-map
  ;;            ("M-<up>" . ein:worksheet-goto-prev-input)
  ;;            ("M-<down>" . ein:worksheet-goto-next-input))

  :commands (dactyl-mode))


;; ;; Automatic Math preview toggle in org-mode
;; ;; Source: http://goo.gl/WLYzxp
;; (defvar org-latex-fragment-last nil
;;   "Holds last fragment/environment you were on.")
;; ;; FIXME Pretty janky right now
;; (defun org-latex-fragment-toggle ()
;;   "Toggle a latex fragment image "
;;   (and (eq 'org-mode major-mode)
;;        (let* ((el (org-element-context))
;;               (el-type (car el)))
;;          (cond
;;           ;; were on a fragment and now on a new fragment
;;           ((and
;;             ;; fragment we were on
;;             org-latex-fragment-last
;;             ;; and are on a fragment now
;;             (or
;;              (eq 'latex-fragment el-type)
;;              (eq 'latex-environment el-type))
;;             ;; but not on the last one this is a little tricky. as you edit the
;;             ;; fragment, it is not equal to the last one. We use the begin
;;             ;; property which is less likely to change for the comparison.
;;             (not (= (org-element-property :begin el)
;;                     (org-element-property :begin org-latex-fragment-last))))
;;            ;; go back to last one and put image back
;;            (save-excursion
;;              (goto-char (org-element-property :begin org-latex-fragment-last))
;;              (org-preview-latex-fragment))
;;            ;; now remove current image
;;            (goto-char (org-element-property :begin el))
;;            (let ((ov (loop for ov in (org--list-latex-overlays)
;;                            if
;;                            (and
;;                             (<= (overlay-start ov) (point))
;;                             (>= (overlay-end ov) (point)))
;;                            return ov)))
;;              (when ov
;;                (delete-overlay ov)))
;;            ;; and save new fragment
;;            (setq org-latex-fragment-last el))

;;           ;; were on a fragment and now are not on a fragment
;;           ((and
;;             ;; not on a fragment now
;;             (not (or
;;                   (eq 'latex-fragment el-type)
;;                   (eq 'latex-environment el-type)))
;;             ;; but we were on one
;;             org-latex-fragment-last)
;;            ;; put image back on
;;            (save-excursion
;;              (goto-char (org-element-property :begin org-latex-fragment-last))
;;              (org-preview-latex-fragment))
;;            ;; unset last fragment
;;            (setq org-latex-fragment-last nil))

;;           ;; were not on a fragment, and now are
;;           ((and
;;             ;; we were not one one
;;             (not org-latex-fragment-last)
;;             ;; but now we are
;;             (or
;;              (eq 'latex-fragment el-type)
;;              (eq 'latex-environment el-type)))
;;            (goto-char (org-element-property :begin el))
;;            ;; remove image
;;            (let ((ov (loop for ov in (org--list-latex-overlays)
;;                            if
;;                            (and
;;                             (<= (overlay-start ov) (point))
;;                             (>= (overlay-end ov) (point)))
;;                            return ov)))
;;              (when ov
;;                (delete-overlay ov)))
;;            (setq org-latex-fragment-last el))))))
;; (add-hook 'post-command-hook 'org-latex-fragment-toggle)
;; bigger latex fragment
(setq org-format-latex-options (quote (:foreground default :background default :scale 2.0 :html-foreground "Black" :html-background "Transparent" :html-scale 2.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\["))))

