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

Support running interactive programs #544

Merged
merged 1 commit into from
May 15, 2024

Conversation

isvilen
Copy link
Contributor

@isvilen isvilen commented May 13, 2024

If universal argument is set before invoking rust-run (C-u C-c C-c C-r) the output buffer will be in Comint mode with
compilation-shell-minor-mode and user input can be processed.

rust-cargo.el Outdated Show resolved Hide resolved
@psibi
Copy link
Member

psibi commented May 14, 2024

@isvilen Looks good to me apart from minor comment. But for this to be merged, this would need two more updates:

  • Update the documentation for this in README
  • Add a specific test for this feature.

@isvilen isvilen force-pushed the run-interactive branch 2 times, most recently from 6b62ad0 to c9ca017 Compare May 14, 2024 06:11
@isvilen
Copy link
Contributor Author

isvilen commented May 14, 2024

I've updated the README file, but I can find any existing tests for rust-cargo.el, so I am not sure how to add a test for this feature.

@psibi
Copy link
Member

psibi commented May 14, 2024

so I am not sure how to add a test for this feature.

We have some tests for it in rustic mode for cargo-run etc: https://github.com/emacs-rustic/rustic/blob/17a79c659b0eb304e35705facb114caf61eae2e9/test/rustic-cargo-test.el#L6

Can you see if you can adapt it from there ? It's okay if it's a separate file.

@isvilen
Copy link
Contributor Author

isvilen commented May 14, 2024

@psibi Added tests for rust-compile and rust-run in interactive and non-interactive mode.

@psibi
Copy link
Member

psibi commented May 14, 2024

@isvilen Thanks, it works and I tested it locally too with a few different program.

Although I was not successful with the test-project/src/main.rs: How do you ensure when running using rust-run that args.len() != 1 since I don't see a way to pass a parameter to cargo run itself.

Probably I'm missing something since I mostly use rustic and rust-mode has different way to pass an option ?

@isvilen
Copy link
Contributor Author

isvilen commented May 14, 2024

@isvilen Thanks, it works and I tested it locally too with a few different program.

Although I was not successful with the test-project/src/main.rs: How do you ensure when running using rust-run that args.len() != 1 since I don't see a way to pass a parameter to cargo run itself.

Probably I'm missing something since I mostly use rustic and rust-mode has different way to pass an option ?

I just set rust-cargo-default-arguments before invoking rust-run see

(setq rust-cargo-default-arguments "interactive")

@psibi psibi merged commit 5e96cd0 into rust-lang:master May 15, 2024
15 of 17 checks passed
@psibi
Copy link
Member

psibi commented May 15, 2024

Thank you!

@isvilen isvilen deleted the run-interactive branch May 15, 2024 06:40
@Andsbf
Copy link

Andsbf commented Jun 27, 2024

thanks you both for that @psibi @isvilen 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants