Move Ruby mode configuration to literate init

This commit is contained in:
Tom Willemse 2016-04-04 12:07:15 +02:00
parent 26a6830956
commit 57d5a8363d
3 changed files with 61 additions and 9 deletions

View file

@ -520,14 +520,8 @@ MODE1 is enabled and vice-versa."
;; Disable line truncation in ERT results. ;; Disable line truncation in ERT results.
(add-hook 'ert-results-mode-hook 'oni:disable-line-truncation) (add-hook 'ert-results-mode-hook 'oni:disable-line-truncation)
(add-hook 'ruby-mode-hook (lambda () (setq-local fci-rule-column 80)))
(add-hook 'projectile-rails-mode-hook (lambda () (define-key projectile-rails-mode-map (kbd "C-c r") 'hydra-projectile-rails/body))) (add-hook 'projectile-rails-mode-hook (lambda () (define-key projectile-rails-mode-map (kbd "C-c r") 'hydra-projectile-rails/body)))
(add-hook 'projectile-mode-hook 'projectile-rails-on) (add-hook 'projectile-mode-hook 'projectile-rails-on)
(add-hook 'ruby-mode-hook 'yard-mode)
(add-hook 'ruby-mode-hook 'eldoc-mode)
(add-hook 'ruby-mode-hook 'ruby-tools-mode)
(add-hook 'ruby-mode-hook 'ruby-refactor-mode-launch)
(add-hook 'ruby-mode-hook 'robe-mode)
(add-hook 'projectile-after-switch-project-hook 'oni:select-corresponding-ruby) (add-hook 'projectile-after-switch-project-hook 'oni:select-corresponding-ruby)
(add-hook 'prog-mode-hook 'highlight-numbers-mode) (add-hook 'prog-mode-hook 'highlight-numbers-mode)
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer) (add-hook 'compilation-filter-hook 'colorize-compilation-buffer)

View file

@ -1333,6 +1333,61 @@
(add-hook 'ruby-mode-hook 'abbrev-mode) (add-hook 'ruby-mode-hook 'abbrev-mode)
#+END_SRC #+END_SRC
Turn on [[Electric pair]] mode.
#+BEGIN_SRC emacs-lisp
(add-hook 'ruby-mode-hook #'electric-pair-local-mode)
#+END_SRC
Turn on [[Electric indent]] mode.
#+BEGIN_SRC emacs-lisp
(add-hook 'ruby-mode-hook #'electric-indent-local-mode)
#+END_SRC
Turn on [[Automatic syntax checking on-the-fly][Flycheck]] mode.
#+BEGIN_SRC emacs-lisp
(add-hook 'ruby-mode-hook 'flycheck-mode)
#+END_SRC
Turn on Yard mode.
#+BEGIN_SRC emacs-lisp
(add-hook 'ruby-mode-hook 'yard-mode)
#+END_SRC
Turn on [[Eldoc]] mode.
#+BEGIN_SRC emacs-lisp
(add-hook 'ruby-mode-hook 'eldoc-mode)
#+END_SRC
Turn on Ruby tools mode.
#+BEGIN_SRC emacs-lisp
(add-hook 'ruby-mode-hook 'ruby-tools-mode)
#+END_SRC
Turn on Ruby refactor mode.
#+BEGIN_SRC emacs-lisp
(add-hook 'ruby-mode-hook 'ruby-refactor-mode-launch)
#+END_SRC
Turn on [[Robe]] mode.
#+BEGIN_SRC emacs-lisp
(add-hook 'ruby-mode-hook 'robe-mode)
#+END_SRC
Set Fill Column Indicator column to the community Ruby Style Guide
recommended value.
#+BEGIN_SRC emacs-lisp
(add-hook 'ruby-mode-hook 'oni:ruby-set-rsg-margin)
#+END_SRC
* Minor mode customization * Minor mode customization
Many minor modes also offer a bit of customization possibilities. Many minor modes also offer a bit of customization possibilities.
@ -1388,7 +1443,6 @@
(add-hook 'js2-mode-hook #'electric-pair-local-mode) (add-hook 'js2-mode-hook #'electric-pair-local-mode)
(add-hook 'lua-mode-hook #'electric-pair-local-mode) (add-hook 'lua-mode-hook #'electric-pair-local-mode)
(add-hook 'python-mode-hook #'electric-pair-local-mode) (add-hook 'python-mode-hook #'electric-pair-local-mode)
(add-hook 'ruby-mode-hook #'electric-pair-local-mode)
(add-hook 'scss-mode-hook #'electric-pair-local-mode) (add-hook 'scss-mode-hook #'electric-pair-local-mode)
(add-hook 'sh-mode-hook #'electric-pair-local-mode) (add-hook 'sh-mode-hook #'electric-pair-local-mode)
#+END_SRC #+END_SRC
@ -1432,7 +1486,6 @@
(add-hook 'css-mode-hook #'electric-indent-local-mode) (add-hook 'css-mode-hook #'electric-indent-local-mode)
(add-hook 'js2-mode-hook #'electric-indent-local-mode) (add-hook 'js2-mode-hook #'electric-indent-local-mode)
(add-hook 'php-mode-hook #'electric-indent-local-mode) (add-hook 'php-mode-hook #'electric-indent-local-mode)
(add-hook 'ruby-mode-hook #'electric-indent-local-mode)
(add-hook 'scss-mode-hook #'electric-indent-local-mode) (add-hook 'scss-mode-hook #'electric-indent-local-mode)
(add-hook 'sh-mode-hook #'electric-indent-local-mode) (add-hook 'sh-mode-hook #'electric-indent-local-mode)
#+END_SRC #+END_SRC
@ -1592,7 +1645,6 @@
(add-hook 'php-mode-hook 'flycheck-mode) (add-hook 'php-mode-hook 'flycheck-mode)
(add-hook 'python-mode-hook 'flycheck-mode) (add-hook 'python-mode-hook 'flycheck-mode)
(add-hook 'rst-mode-hook 'flycheck-mode) (add-hook 'rst-mode-hook 'flycheck-mode)
(add-hook 'ruby-mode-hook 'flycheck-mode)
(add-hook 'rust-mode-hook 'flycheck-mode) (add-hook 'rust-mode-hook 'flycheck-mode)
(add-hook 'sh-mode-hook 'flycheck-mode) (add-hook 'sh-mode-hook 'flycheck-mode)
(add-hook 'texinfo-mode-hook 'flycheck-mode) (add-hook 'texinfo-mode-hook 'flycheck-mode)

View file

@ -24,6 +24,7 @@
;;; Code: ;;; Code:
(require 'fill-column-indicator)
(require 'projectile-rails) (require 'projectile-rails)
(require 'rvm) (require 'rvm)
@ -34,5 +35,10 @@
(projectile-rails-root)) (projectile-rails-root))
(rvm-activate-ruby-for (projectile-rails-root)))) (rvm-activate-ruby-for (projectile-rails-root))))
;;;###autoload
(defun oni:ruby-set-rsg-margin ()
"Set the `fci-rule-column' to the Ruby Style Guide recommendation."
(setq-local fci-rule-column 80))
(provide 'oni-ruby) (provide 'oni-ruby)
;;; oni-ruby.el ends here ;;; oni-ruby.el ends here