lang/rust: run cargo commands from Cargo.toml dir

Instead of the current directory, which breaks file links in the
compilation buffer.
This commit is contained in:
Henrik Lissner 2019-04-10 18:51:37 -04:00
parent da34862e56
commit 8e18b402ce
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 10 additions and 4 deletions

View file

@ -6,3 +6,9 @@
(defun +rust-cargo-project-p ()
"Return t if this is a cargo project."
(locate-dominating-file buffer-file-name "Cargo.toml"))
;;;###autoload
(defun +rust-cargo-compile (command)
"TODO"
(let ((default-directory (+rust-cargo-project-p)))
(compile command)))