brotzeit / rustic

Rust development environment for Emacs
Apache License 2.0
728 stars 102 forks source link

After rustic-cargo-build/run succssful, and switch to new compilation buffer, this buffer is writable, and can be edit. #194

Closed zw963 closed 3 years ago

zw963 commented 3 years ago

Following is a reproduce:

Write a main.rs, ensure it can be run sucessful.

run it with rustic-cargo-run, we can see outout result is successful.

image

Try input somethings try to quit current buffer and close window, e.g. q, get following.

image

expected.

this compilation buffer should be a readonly buffer, and should permit user binding q to quit-window as it does like rustic-recompile

Thank you.

wannestas commented 3 years ago

This was actually a fix to a previous bug, changed last week. If your program expects input, it's sort of tedious to enable comint mode and disable read-only mode every time your program asks for input. That's why it was changed to this.

brotzeit commented 3 years ago

@zw963 thanks for opening the issue, but as @wannestas mentioned users want to send input to the process without running an additional command and I can totally understand it. If you prefer running a command before entering your input you can define a function that calls 'cargo run'.

(defun my-cargo-run ()
  (interactive)
  (call-interactively 'rustic-compile "cargo run"))
zw963 commented 3 years ago

Thanks for explain

zw963 commented 3 years ago

Do we consider add a new function as old fashion rustic-cargo-run function? we can keep this new function as default.

Or add a optional args bfor this?

Anyway, for me, in most of my case, i don't input anythings, jus want to see the running result in compilation buffer, and quit immedately. IMO, if we need input somethings, in most case, run it on the terminal is the better

This just a personal advice, i solved this issue too with binding (quit-window) to a key combination instead of q anyway.

brotzeit commented 3 years ago

Hmmm, I'm not sure what's the best solution to cover both needs. Want to come up with a pull request that contains something that fits your needs ?

zw963 commented 3 years ago

Hmmm, I'm not sure what's the best solution to cover both needs. Want to come up with a pull request that contains something that fits your needs ?

At least, should we only writable if build successful? anyway, build failed with writable was not so useful.

brotzeit commented 3 years ago

I don't know how we can detect when build has finished and run has started.