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:
parent
da34862e56
commit
8e18b402ce
2 changed files with 10 additions and 4 deletions
|
@ -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)))
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
(map! :map rust-mode-map
|
||||
:localleader
|
||||
:prefix "b"
|
||||
:desc "cargo build" "b" (λ! (compile "cargo build --color always"))
|
||||
:desc "cargo check" "c" (λ! (compile "cargo check --color always"))
|
||||
:desc "cargo run" "r" (λ! (compile "cargo run --color always"))
|
||||
:desc "cargo test" "t" (λ! (compile "cargo test --color always"))))
|
||||
:desc "cargo build" "b" (λ! (+rust-cargo-compile "cargo build --color always"))
|
||||
:desc "cargo check" "c" (λ! (+rust-cargo-compile "cargo check --color always"))
|
||||
:desc "cargo run" "r" (λ! (+rust-cargo-compile "cargo run --color always"))
|
||||
:desc "cargo test" "t" (λ! (+rust-cargo-compile "cargo test --color always"))))
|
||||
|
||||
|
||||
(def-package! racer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue