I have a Ruby Electric mode installed through ELPA.
I visited the ruby โโfile ~/test.rb
Ch m shows that ruby โโelectric mode is turned on as a font lock, see output below
Enabled minor modes: Auto-Compression Auto-Encryption Blink-Cursor Column-Number Delete-Selection File-Name-Shadow Global-Font-Lock Global-Linum Iswitchb Line-Number Menu-Bar Mouse-Wheel Shell-Dirtrack Tooltip Transient-Mark
However, when I enter the code, for example:
class Test def foo()
I do not get auto end automatically inserted when RET pressed
UPDATE
I installed via package-list , as recommended on the page I found, which I thought belonged to the author. Looking at the source ~/emacs.d/elpa/ruby-electric-1.1/ruby-electric.el , I see the following:
;; FIXME: it should be available in next versions of ruby-mode.el (defun ruby-insert-end () (interactive) (insert "end") (ruby-indent-line t) (end-of-line))
So it looks like I have a bad file, try another one.
UPDATE
I used ruby-electric.el , downloaded from http://svn.ruby-lang.org/repos/ruby/tags/v1_9_2_0/misc/ruby-electric.el
Link to this article http://appsintheopen.com/articles/1-setting-up-emacs-for-rails-development/part/7-emacs-ruby-foo
Then took this gist https://gist.github.com/1213051 , adding this to ruby-electric.el
(defun ruby-insert-end () "Insert \"end\" at point and reindent current line." (interactive) (insert "end") (ruby-indent-line t) (end-of-line))
And this hook in my .emacs , it also works without a hook
(add-hook 'ruby-mode-hook (lambda () (require 'ruby-electric) (ruby-electric-mode t)))
As discussed in this section of google groups; https://groups.google.com/forum/?fromgroups#!msg/emacs-on-rails/Cuh_x5eCK_M/KDwjY4K6X1YJ