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

Correctly handle directory on rerun #5

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions rustic-cargo.el
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ If ARG is not nil, use value as argument and store it in
(defun rustic-cargo-test-rerun ()
"Run 'cargo test' with `rustic-test-arguments'."
(interactive)
(rustic-cargo-test-run rustic-test-arguments))
(let ((default-directory (or rustic-compilation-directory default-directory)))
(rustic-cargo-test-run rustic-test-arguments)))

;;;###autoload
(defun rustic-cargo-current-test ()
Expand Down Expand Up @@ -619,7 +620,8 @@ When calling this function from `rustic-popup-mode', always use the value of
(defun rustic-cargo-run-rerun ()
"Run 'cargo run' with `rustic-run-arguments'."
(interactive)
(rustic-cargo-run-command rustic-run-arguments))
(let ((default-directory (or rustic-compilation-directory default-directory)))
(rustic-cargo-run-command rustic-run-arguments)))

(defun rustic--get-run-arguments ()
"Helper utility for getting arguments related to 'examples' directory."
Expand Down
4 changes: 4 additions & 0 deletions rustic-compile.el
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ Error matching regexes from compile.el are removed."

;;; Compilation Process

(defvar-local rustic-compilation-directory nil
"original directory for rust compilation process.")

(defvar rustic-compilation-process-name "rustic-compilation-process"
"Process name for rust compilation processes.")

Expand Down Expand Up @@ -251,6 +254,7 @@ Set environment variables for rust process."
(erase-buffer)
(setq default-directory dir)
(funcall mode)
(setq-local rustic-compilation-directory dir)
(unless no-mode-line
(setq mode-line-process
'((:propertize ":%s" face compilation-mode-line-run)
Expand Down
Loading