Skip to content

Commit

Permalink
暂时修复 python-layer , s i 的问题
Browse files Browse the repository at this point in the history
from syl20bnr/spacemacs#7070
等不及PR了
  • Loading branch information
Liu's DeskTop committed Oct 12, 2016
1 parent 4f19412 commit b5babdd
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions layers/liu233w/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
chinese-pyim-greatdict
chinese-pyim-basedict
chinese-pyim
(python :location built-in)
)
"The list of Lisp packages required by the liu233w layer.
Expand Down Expand Up @@ -542,4 +543,33 @@ Each entry is either:
;; ========================================================================
)

(defun liu233w/post-init-python ()
;; fix: https://github.com/gregsexton/ob-ipython/issues/28
(setq python-shell-completion-native-enable nil)

;; from: https://github.com/syl20bnr/spacemacs/pull/7070
;; 我等不及合并PR 了
(defun fix-to-python-start-or-switch-repl ()
"Start and/or switch to the REPL."
(interactive)
(let ((shell-process
(or (python-shell-get-process)
;; `run-python' has different return values and different
;; errors in different emacs versions. In 24.4, it throws an
;; error when the process didn't start, but in 25.1 it
;; doesn't throw an error, so we demote errors here and
;; check the process later
(with-demoted-errors "Error: %S"
;; in Emacs 24.5 and 24.4, `run-python' doesn't return the
;; shell process
(call-interactively #'run-python)
(python-shell-get-process)))))
(unless shell-process
(error "Failed to start python shell properly"))
(pop-to-buffer (process-buffer shell-process))
(evil-insert-state)))
(advice-add #'python-start-or-switch-repl :override
#'fix-to-python-start-or-switch-repl)
)

;;; packages.el ends here

0 comments on commit b5babdd

Please sign in to comment.