[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rubocop 03bf155 52/64: Run auto-correct automatically on s
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rubocop 03bf155 52/64: Run auto-correct automatically on save (#29) |
Date: |
Wed, 11 Aug 2021 10:08:03 -0400 (EDT) |
branch: elpa/rubocop
commit 03bf15558a6eb65e4f74000cab29412efd46660e
Author: Daniel Luna <dancluna@gmail.com>
Commit: Bozhidar Batsov <bozhidar.batsov@gmail.com>
Run auto-correct automatically on save (#29)
---
rubocop.el | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/rubocop.el b/rubocop.el
index 26913f4..7a65b3a 100644
--- a/rubocop.el
+++ b/rubocop.el
@@ -68,6 +68,11 @@
:group 'rubocop
:type 'string)
+(defcustom rubocop-autocorrect-on-save nil
+ "Runs `rubocop-autocorrect-current-file' automatically on save."
+ :group 'rubocop
+ :type 'boolean)
+
(defcustom rubocop-prefer-system-executable nil
"Runs rubocop with the system executable even if inside a bundled project."
:group 'rubocop
@@ -187,6 +192,10 @@ Alternatively prompt user for directory."
(interactive)
(rubocop--file-command rubocop-autocorrect-command))
+(defun rubocop-autocorrect-current-file-silent ()
+ (if rubocop-autocorrect-on-save
+ (save-window-excursion (rubocop-autocorrect-current-file))))
+
(defun rubocop-bundled-p ()
"Check if RuboCop has been bundled."
(let ((gemfile-lock (expand-file-name "Gemfile.lock"
(rubocop-project-root))))
@@ -220,7 +229,10 @@ Alternatively prompt user for directory."
"Minor mode to interface with RuboCop."
:lighter " RuboCop"
:keymap rubocop-mode-map
- :group 'rubocop)
+ :group 'rubocop
+ (cond
+ (rubocop-mode (add-hook 'before-save-hook
'rubocop-autocorrect-current-file-silent nil t))
+ (t (remove-hook 'before-save-hook 'rubocop-autocorrect-current-file-silent
t))))
(provide 'rubocop)
- [nongnu] elpa/rubocop f5fd18a 64/64: Add the ability to format on save, (continued)
- [nongnu] elpa/rubocop f5fd18a 64/64: Add the ability to format on save, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop b0c5bc2 62/64: Tweak a heading, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 608a3c1 58/64: Release 0.6.0, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 0131536 39/64: Fix a docstring, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 1372ee3 60/64: Tweak some wording, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 2c884cd 25/64: Merge pull request #15 from fap-/load_tramp_dependency, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop f947fb0 30/64: Fix byte-compile warning about unused variable, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 02ad056 35/64: [Fix #17] Consider rubocop installed if bundled, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 676cabe 36/64: Expand the project root path, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop a809fa7 42/64: [Fix #24] Always run RuboCop from the project's root when within a, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 03bf155 52/64: Run auto-correct automatically on save (#29),
ELPA Syncer <=
- [nongnu] elpa/rubocop 38d982a 56/64: Add a note about alternative packages, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop d44737a 43/64: Fix a reference to RuboCop, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 980bedb 49/64: Release 0.5, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 8e9ec29 06/64: Update for RuboCop 0.9 (fixes #1), ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop dcde702 29/64: Improve the README a bit, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 0ab1329 50/64: Update the README, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 8b2c1f5 57/64: Remove mention of Prelude, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 0b4e5ce 61/64: Add an option to execute rubocop in a chroot, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 9b23b05 22/64: Make rubocop-emacs TRAMP-aware, ELPA Syncer, 2021/08/11
- [nongnu] elpa/rubocop 40a1d5a 19/64: Merge pull request #6 from bhfailor/master, ELPA Syncer, 2021/08/11