Skip to content

Commit 5d9a3d4

Browse files
committed
le-python.el (lispy--python-poetry-name): Don't fail outside of project
File can be outside of project (so no root) or may not use poetry/pyproject.toml.
1 parent db4c8a8 commit 5d9a3d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

le-python.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ it at one time."
298298
(defvar lispy--python-init-file nil)
299299

300300
(defun lispy--python-poetry-name ()
301-
(let ((pyproject
302-
(file-name-directory (locate-dominating-file (buffer-file-name) "pyproject.toml"))))
301+
(when-let* ((root (locate-dominating-file (buffer-file-name) "pyproject.toml"))
302+
(pyproject (file-name-directory root)))
303303
(and (file-exists-p pyproject)
304304
(not (equal python-shell-interpreter "python"))
305305
(with-current-buffer (find-file-noselect pyproject)

0 commit comments

Comments
 (0)