lang/python: fix stringp errors when opening REPL

Caused my misuse of if-let* to let-bind dynamic variables. The expanded
code doesn't quite work out the way I expected, causing
python-shell-interpreter to be nil regardless of which side of the
if-else statement ran.
This commit is contained in:
Henrik Lissner 2018-10-02 23:52:29 -04:00
parent 6368ef9ba0
commit 63b195b133
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -7,16 +7,20 @@
(defun +python/repl ()
"Open the Python REPL."
(interactive)
(unless python-shell-interpreter
(user-error "`python-shell-interpreter' isn't set"))
(pop-to-buffer
(process-buffer
(let ((interp python-shell-interpreter)
(interp-args python-shell-interpreter-args))
(if-let* ((bin (executable-find "pipenv"))
(default-directory (pipenv-project-p))
(python-shell-interpreter "pipenv")
(python-shell-interpreter-args (format "run %s %s" interp interp-args)))
(run-python nil t t)
(run-python nil t t))))))
(if-let* ((pipenv (executable-find "pipenv"))
(pipenv-project (pipenv-project-p)))
(let ((default-directory pipenv-project)
(python-shell-interpreter-args
(format "run %s %s"
python-shell-interpreter
python-shell-interpreter-args))
(python-shell-interpreter pipenv))
(run-python nil t t))
(run-python nil t t)))))
(defun +python--extract-version (prefix str)
(when str