mirror of
https://github.com/jimeh/rubocopfmt.el.git
synced 2026-02-19 09:06:41 +00:00
Add option to customize which major modes rubocopfmt-mode applies to
It also enables rubocopfmt to work with the enh-ruby-mode out of the
box, in addition to the default ruby-mode it already supported. And
additional major modes can be added via:
M-x customize-group rubocopfmt
Fixes issue #2.
This commit is contained in:
@@ -84,6 +84,11 @@ inside a `before-save-hook'."
|
||||
(const :tag "None" nil))
|
||||
:group 'rubocopfmt)
|
||||
|
||||
(defcustom rubocopfmt-major-modes '(ruby-mode enh-ruby-mode)
|
||||
"List of major modes to format on save when rubocopfmt-mode is enabled."
|
||||
:type '(repeat symbol)
|
||||
:group 'rubocopfmt)
|
||||
|
||||
|
||||
(defun rubocopfmt--apply-rcs-patch (patch-buffer)
|
||||
"Apply an RCS-formatted diff from PATCH-BUFFER to the current buffer."
|
||||
@@ -278,7 +283,7 @@ If FILE is not found in DIRECTORY, the parent of DIRECTORY will be searched."
|
||||
(defun rubocopfmt-before-save ()
|
||||
"Format buffer via rubocopfmt if major mode is `ruby-mode'."
|
||||
(interactive)
|
||||
(when (eq major-mode 'ruby-mode) (rubocopfmt)))
|
||||
(when (member major-mode rubocopfmt-major-modes) (rubocopfmt)))
|
||||
|
||||
(provide 'rubocopfmt)
|
||||
;;; rubocopfmt.el ends here
|
||||
|
||||
Reference in New Issue
Block a user