Skip to content

Cannot complete Rust Book Ch. 2 exercises in Rustic #88

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

Open
daveloyall opened this issue Feb 24, 2025 · 4 comments
Open

Cannot complete Rust Book Ch. 2 exercises in Rustic #88

daveloyall opened this issue Feb 24, 2025 · 4 comments

Comments

@daveloyall
Copy link

Hello.

Chapter 2 of the Rust book invites the reader to code a guessing game that takes input on stdin. This works fine in a terminal.

In Rustic, you'd want to set the variable rustic-cargo-run-use-comint to t before invoking C-c C-c C-r (rustic-cargo-run).

But, that doesn't cause the code in rustic-comint.el to fire. I still get the regular rustic-cargo-run functionality.

I do have polymode installed.

Here are some particulars.

GNU Emacs 29.4 (build 2, x86_64-w64-mingw32) of 2024-07-05

Package rustic:
Version: 20250220.14
Commit: fbbf0a7

I'm happy to provide more details or troubleshooting, just tell me how.

@CeleritasCelery
Copy link
Contributor

This is a part of the code that I have never looked into before. I was able to get it to work using rustic-cargo-plain-run with rustic-cargo-run-use-comint == t. I am not sure how this is supposed to interact with the normal rustic-cargo-run.

@psibi
Copy link
Member

psibi commented Feb 27, 2025

But, that doesn't cause the code in rustic-comint.el to fire.

If you want the comint functionality, you would have to use rustic-cargo-comint-run. There are some docs that might be helpful: https://github.com/emacs-rustic/rustic?tab=readme-ov-file#run

I haven't been using these functions recently since I don't interact much with interactive programs. But the last time I used them - it seemed to be working.

@daveloyall
Copy link
Author

I can confirm M-x rustic-cargo-comint-run gets the job done. Thank you very much!

I hadn't seen rustic-cargo-plain-run before, and it may be of use to me, thanks.

FWIW, this may be an opportunity to improve the runtime documentation.

Yes, this one might just be wrong, since rustic-cargo-run doesn't seem to actually check this variable? (Or, is the documentation right, and the command needs to be changed?)

M-x describe-variable rustic-cargo-run-use-comint

rustic-cargo-run-use-comint is a variable defined in ‘rustic-comint.el’.

Its value is t
Original value was nil

If t then interact with programs in ‘rustic-cargo-run’ using
comint-mode.  This creates a dependency on the polymode package.
No special configuration of polymode is needed for this to work,
but you need to install polymode separately.

  You can customize this variable.

[back]

And this one could probably benefit from the addition of some language from README.md.

M-x describe-command rustic-cargo-plain-run

rustic-cargo-plain-run is an autoloaded interactive byte-compiled Lisp
function in ‘rustic-comint.el’.

(rustic-cargo-plain-run &optional ARG)

Run ‘cargo run’ for the current project.
Read the full command from the minibuffer when ARG is non-nil or
when called with a prefix command C-u.

[back]

From a "user support" point of view.. this matter is completely resolved for me.

From a "improve rustic" point of view.. I'm willing to create a PR with updated docstrings, but I'm also willing to stay out of the way. Y'all tell me what is preferred. :) And thanks again.

@psibi
Copy link
Member

psibi commented Feb 27, 2025

Yes, this one might just be wrong, since rustic-cargo-run doesn't seem to actually check this variable? (Or, is the documentation right, and the command needs to be changed?)

Nah, the documentation is wrong.

And this one could probably benefit from the addition of some language from README.md.

Yes, agree. I think I implemented one of these functions and documented the README.md, but didn't update the docstrings.

I'm willing to create a PR with updated docstrings,

Yes, that will be helpful. Thanks!

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

No branches or pull requests

3 participants