Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7848719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:18:06+00:00 2026-06-02T18:18:06+00:00

I have Ruby Electric mode installed via ELPA. I have visited a ruby file

  • 0

I have Ruby Electric mode installed via ELPA.

I have visited a ruby file ~/test.rb

C-h m reveals that ruby electric mode is enabled as is 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 code like;

class Test
  def foo()

I don’t get any end auto inserted on hitting RET

UPDATE

I installed via package-list as that was recommended on the page I found, which I thought belonged to the author. Looking at the source of ~/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 might have a bad file, will try another.

UPDATE

I used ruby-electric.el downloaded from http://svn.ruby-lang.org/repos/ruby/tags/v1_9_2_0/misc/ruby-electric.el

Linked to from 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 into my .emacs, it also appears to work without the hook

(add-hook 'ruby-mode-hook
      (lambda ()
        (require 'ruby-electric)
        (ruby-electric-mode t)))

As discussed in this google groups thread; https://groups.google.com/forum/?fromgroups#!msg/emacs-on-rails/Cuh_x5eCK_M/KDwjY4K6X1YJ

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:18:10+00:00Added an answer on June 2, 2026 at 6:18 pm

    Make sure it says REl in your Emacs status bar.

    I downloaded ruby-electric from here:
    http://shylock.uw.hu/Emacs/ruby-electric.el

    I then loaded the library into Emacs, and went into a ruby file and activated
    ruby electric with:

    M-x ruby-electric-mode
    

    When I type class and hit space it fills in the end automatically (running Emacs 23). Maybe you want to give that version of ruby-electric.el a try, if you can’t get the one from ELPA to work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

so i have ruby script that simply writes to a test.txt file with hello
I have ruby build file that we used to read the assembly attributes that
I have ruby on rails installed on my ubuntu 8.10 desktop. Script/generate came up
I have a ruby application that executes ant as a subprocess using backtick. This
I have a Ruby 1.8.6 script that is supposed to take a filename that
I have a ruby script that does a few perforce operations (through the scripting
I have a ruby script that is simultaneously and asynchronously receiving and displaying messages
I have ruby on rails installed on my Desktop running ruby 1.8.7 and rails
I am attempting to install Ruby with RVM. I already have Ruby installed, but
I have ruby 1.9.2 installed on my system (Ubuntu) using rvm, but one application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.