-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Automatically runs Rubocop on save #29
Automatically runs Rubocop on save #29
Conversation
rubocop.el
Outdated
:group 'rubocop | ||
(when rubocop-autocorrect-on-save | ||
(if rubocop-mode | ||
(add-hook 'before-save-hook 'rubocop-autocorrect-current-file-silent nil t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better if there was some function added to the hook that checks the value of the defcustom instead. That way if you toggle the defcustom you won't have to restart rubocop-mode
.
rubocop.el
Outdated
@@ -182,6 +187,9 @@ Alternatively prompt user for directory." | |||
(interactive) | |||
(rubocop--file-command rubocop-autocorrect-command)) | |||
|
|||
(defun rubocop-autocorrect-current-file-silent () | |||
(save-window-excursion (rubocop-autocorrect-current-file))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be better to add some option to the existing command to correct silently.
This is great! Could I make it work with |
I have been using these a couple of days and I love it. Is there a way I can avoid it gets executed when |
@sadhu89 I was thinking you could customize this function in |
I forgot to merge this. Please rebase it and ping me afterwards, so we can wrap it up. |
dcfa512
to
c9ff017
Compare
@bbatsov ping |
Thanks! |
Could you make a statement in the README.md also? I always get |
@grauschnabel If you run I recommend doing |
Does exactly what it says on the tin.
Addresses #10, and probably #21 too.