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

Add opt params to projectile-run-(async)-shell-cmd #1675

Merged
merged 3 commits into from
Jun 29, 2021
Merged

Add opt params to projectile-run-(async)-shell-cmd #1675

merged 3 commits into from
Jun 29, 2021

Conversation

viglioni
Copy link
Contributor

The problem:

The commands async-shell-command and shell-command accept up to three parameters:
COMMAND &OPTIONAL OUTPUT-BUFFER ERROR-BUFFER, the commands projectile-run-shell-command-on-root and projectile-run-async-shell-command-on-root (which call those commands above) are not callable non-interactively and can't pass the two optional parameters to the (async)-shell-command.

Solution:

Change the signature of these two functions to match the (async)-shell-command:

(defun projectile-run-shell-command-in-root (command &optional output-buffer error-buffer)
 ...)

(defun projectile-run-async-shell-command-in-root (command &optional output-buffer error-buffer)
 ...)
  • So they can be now called directly from an elisp code.
  • It is important to emphasize that the interactive call behaves exactly as it did before, so it is not a breaking change in anyway.
  • I also added tests for these changes. I could not add tests to check if these functions are actually called in the root of the project because I didn't know how, but I can add them too if someone guides me :)
  • Obs.: the M-x checkdoc was generating some warnings before I made any change, but there were none when byte-compiling
  • I didn't add anything to the README because I think this change is self-documented in code, but I can add if the maintainers find it necessary

Before submitting a PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):

  • The commits are consistent with our contribution guidelines
  • You've added tests (if possible) to cover your change(s)
  • All tests are passing (eldev test)
  • The new code is not generating bytecode or M-x checkdoc warnings
  • You've updated the changelog (if adding/changing user-visible functionality)
  • You've updated the readme (if adding/changing user-visible functionality)

Thanks!

@bbatsov bbatsov merged commit e8a3f11 into bbatsov:master Jun 29, 2021
@bbatsov
Copy link
Owner

bbatsov commented Jun 29, 2021

Nice improvement. 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

Successfully merging this pull request may close these issues.

2 participants