Load python on REPL commands

To fix 'void-variable python-shell-interpreter' and similar errors.
This commit is contained in:
Henrik Lissner 2020-05-14 01:53:41 -04:00
parent a239326165
commit f2c9e40d44
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -4,6 +4,7 @@
(defun +python/open-repl () (defun +python/open-repl ()
"Open the Python REPL." "Open the Python REPL."
(interactive) (interactive)
(require 'python)
(unless python-shell-interpreter (unless python-shell-interpreter
(user-error "`python-shell-interpreter' isn't set")) (user-error "`python-shell-interpreter' isn't set"))
(pop-to-buffer (pop-to-buffer
@ -23,6 +24,7 @@
(defun +python/open-ipython-repl () (defun +python/open-ipython-repl ()
"Open an IPython REPL." "Open an IPython REPL."
(interactive) (interactive)
(require 'python)
(let ((python-shell-interpreter (or (+python-executable-find "ipython") "ipython")) (let ((python-shell-interpreter (or (+python-executable-find "ipython") "ipython"))
(python-shell-interpreter-args (string-join +python-ipython-repl-args " "))) (python-shell-interpreter-args (string-join +python-ipython-repl-args " ")))
(+python/open-repl))) (+python/open-repl)))
@ -31,6 +33,7 @@
(defun +python/open-jupyter-repl () (defun +python/open-jupyter-repl ()
"Open a Jupyter console." "Open a Jupyter console."
(interactive) (interactive)
(require 'python)
(add-to-list 'python-shell-completion-native-disabled-interpreters "jupyter") (add-to-list 'python-shell-completion-native-disabled-interpreters "jupyter")
(let ((python-shell-interpreter (or (+python-executable-find "jupyter") "jupyter")) (let ((python-shell-interpreter (or (+python-executable-find "jupyter") "jupyter"))
(python-shell-interpreter-args (format "console %s" (string-join +python-jupyter-repl-args " ")))) (python-shell-interpreter-args (format "console %s" (string-join +python-jupyter-repl-args " "))))