mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
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:
@ -6,3 +6,9 @@
|
|||||||
(defun +rust-cargo-project-p ()
|
(defun +rust-cargo-project-p ()
|
||||||
"Return t if this is a cargo project."
|
"Return t if this is a cargo project."
|
||||||
(locate-dominating-file buffer-file-name "Cargo.toml"))
|
(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
|
(map! :map rust-mode-map
|
||||||
:localleader
|
:localleader
|
||||||
:prefix "b"
|
:prefix "b"
|
||||||
:desc "cargo build" "b" (λ! (compile "cargo build --color always"))
|
:desc "cargo build" "b" (λ! (+rust-cargo-compile "cargo build --color always"))
|
||||||
:desc "cargo check" "c" (λ! (compile "cargo check --color always"))
|
:desc "cargo check" "c" (λ! (+rust-cargo-compile "cargo check --color always"))
|
||||||
:desc "cargo run" "r" (λ! (compile "cargo run --color always"))
|
:desc "cargo run" "r" (λ! (+rust-cargo-compile "cargo run --color always"))
|
||||||
:desc "cargo test" "t" (λ! (compile "cargo test --color always"))))
|
:desc "cargo test" "t" (λ! (+rust-cargo-compile "cargo test --color always"))))
|
||||||
|
|
||||||
|
|
||||||
(def-package! racer
|
(def-package! racer
|
||||||
|
Reference in New Issue
Block a user