Skip to content

Commit

Permalink
Merge pull request #5 from emacs-rustic/rerun-fix
Browse files Browse the repository at this point in the history
Correctly handle directory on rerun
  • Loading branch information
CeleritasCelery committed May 17, 2024
2 parents 0c29fcd + 051bab1 commit 63ce443
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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

0 comments on commit 63ce443

Please sign in to comment.