Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rustic-babel): disable toolchain when invalid/unneeded #3

Merged
merged 3 commits into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions rustic-babel.el
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@
:type 'boolean
:group 'rustic-babel)

(defcustom rustic-babel-default-toolchain "stable"
(defcustom rustic-babel-default-toolchain nil
"Active toolchain for babel blocks.
When passing a toolchain to a block as argument, this variable won't be
considered."
:type 'string
:type '(choice (string :tag "String")
(const :tag "Nil" nil))
:group 'rustic-babel)

(defvar rustic-babel-buffer-name '((:default . "*rust-babel*")))
Expand Down Expand Up @@ -70,8 +71,9 @@ should be wrapped in which case we will disable rustfmt."
((eq toolchain-kw-or-string 'beta) "+beta")
((eq toolchain-kw-or-string 'stable) "+stable")
(toolchain-kw-or-string (format "+%s" toolchain-kw-or-string))
(t (format "+%s" rustic-babel-default-toolchain))))
(params (list (rustic-cargo-bin) toolchain "build" "--quiet"))
(rustic-babel-default-toolchain (format "+%s" rustic-babel-default-toolchain))
(t nil)))
(params (remove nil (list (rustic-cargo-bin) toolchain "build" "--quiet")))
(inhibit-read-only t))
(rustic-compilation-setup-buffer err-buff dir 'rustic-compilation-mode)
(when rustic-babel-display-compilation-buffer
Expand Down Expand Up @@ -122,7 +124,7 @@ execution with rustfmt."

;; run project
(let* ((err-buff (get-buffer-create rustic-babel-compilation-buffer-name))
(params (list (rustic-cargo-bin) toolchain "run" "--quiet"))
(params (remove nil (list (rustic-cargo-bin) toolchain "run" "--quiet")))
(inhibit-read-only t))
(rustic-make-process
:name rustic-babel-process-name
Expand Down
Loading