rustic icon indicating copy to clipboard operation
rustic copied to clipboard

Confusion on the behavior of rustic-cargo-run, rustic-cargo-plain-run and rustic-comint-run

Open hi563145 opened this issue 2 years ago • 2 comments

Confusion

rustic-cargo-run and rustic-cargo-comint-run

The documentation string says that when arg is nil, the value of arg would be used and stored in rustic-run-arguments. However, the actual behavior is getting the value from mini buffer and storing it to rustic-run-arguments (rustic-run-comint-arguments for rustic-cargo-comint-run).

rustic-cargo-plain-run

The function does what the documentation says. However, if the arg is nil it still reads the arguments from the mini buffer.

Proposal

All rustic-cargo-run, rustic-cargo-plain-run and rustic-comint-run:

  • Will set a common variable rustic-run-arguments and use the value if arg is non-nil.
  • A configuration rustic-cargo-use-last-stored-arguments, when set to nil will get and store the arguments to the common variable from mini buffer. When set to non-nil would use the common variable as arguments.
  • The arguments would be appended to cargo run.
  • Change documentation accordingly

Additional Features

  • Auto fills mini buffer if is in example directory.
  • Auto fills mini buffer if there are multiple binary crates.

hi563145 avatar Jun 29 '23 09:06 hi563145

The documentation string likely needs to be improved. Does the documentation for the run commands on the README.md help in clarifying things: https://github.com/brotzeit/rustic#run ?

psibi avatar Jun 29 '23 10:06 psibi

Not really as the reason why I am confused is because I wanted to run in comint mode with specific command line argument (I have multiple binary crates). This lead me to look into the source code and notice the behavior is kinda inconsistent. I am curious about what you think about my proposal as I am looking into learning some elisp and might be able to contribute.

hi563145 avatar Jul 02 '23 06:07 hi563145