fix(tazjin/emacs): don't crash in find-cargo-project

Change-Id: I8a94892a527958946c975047204000eaf15395f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8946
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: tazjin <tazjin@tvl.su>
This commit is contained in:
Vincent Ambo 2023-07-09 01:12:26 +03:00 committed by clbot
parent 20acf3ecfd
commit d73e8fb041

View file

@ -301,10 +301,11 @@ the GPG agent correctly."
(defun find-cargo-project (dir)
"Attempt to find the current project in `project-find-functions'
by looking for a `Cargo.toml' file."
(unless (equal "/" dir)
(if (f-exists-p (f-join dir "Cargo.toml"))
(cons 'transient dir)
(find-cargo-project (f-parent dir)))))
(when dir
(unless (equal "/" dir)
(if (f-exists-p (f-join dir "Cargo.toml"))
(cons 'transient dir)
(find-cargo-project (f-parent dir))))))
(add-to-list 'project-find-functions #'find-cargo-project)