Skip to content

Instantly share code, notes, and snippets.

@stuartsierra
Created September 12, 2011 20:29
Show Gist options
  • Save stuartsierra/1212314 to your computer and use it in GitHub Desktop.
Save stuartsierra/1212314 to your computer and use it in GitHub Desktop.
Enable Electric Ruby Mode in Emacs
;; Add this to ~/.emacs
;; Missing from ruby-mode.el, see https://groups.google.com/group/emacs-on-rails/msg/565fba8263233c28
(defun ruby-insert-end ()
"Insert \"end\" at point and reindent current line."
(interactive)
(insert "end")
(ruby-indent-line t)
(end-of-line))
(add-hook 'ruby-mode-hook
(lambda ()
(require 'ruby-electric)
(ruby-electric-mode t)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment