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:
parent
6368ef9ba0
commit
63b195b133
1 changed files with 12 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue