Emacs: ruby-electric-return

I’ve made a patch to improve the ruby-electric-mode for Emacs. If you use Emacs to edit Ruby code, please try it out and tell me what you think!

I’ve created a patch to the ruby-electric-mode for Emacs, which makes pressing return after certain keywords automatically
insert an “end” statement, just like pressing space does.

So, if you type this:

  begin

when you press return, it will become:

  begin

  end

It will put the cursor on the line between “begin” and “end” and automatically indent, so you can
start typing more code right away!

It will work with the other keywords that electric-space does, too. For example, when writing RSpec, you can type:

  it "should be empty" do

and then press return, it will insert the “end” for you.

Before, you would have to press space and then return, which seemed unnatural to me. However, I have made
ruby-electric-return smart enough not to work against you if you have the habit of doing space and then return: it will
only insert the “end” if you press return with the cursor directly after the keyword.

Also, I added a customizable variable, “ruby-electric-return”, which can be used to disable this feature if
you don’t like it. I made it on by default, but I won’t be offended if you change the patch (line 7) to make it off
by default instead.

I welcome any suggestions or comments.

The Magic of Interwebs 2.0

[Update, May 25 – I changed over to Mephisto, and the sidebar doesn’t currently have the Ta-da lists anymore.]

If you look down at the bottom right side of my blog (i.e. where you are now, unless you’re reading this somewhere else… hmmm), you’ll see “Rubygame 3 Checklist (Public Ta-da list)”. Underneath that, you’ll see a whole load of things I have to do before I’ll consider Rubygame 3 to be ready for release. And the list is updated as I check things off… or more likely, add new items.

That’s the magic of the Interwebs 2.0, my friends: integration of your pointless online to-do list with your pointless online blog. Pretty neat, huh?

Right now, the list has 16 to-do items on it. Any bets on how long before it has grown to over 30 items? (“To-do lists: you’re doing it wrong.”)

P.S. I should update my pointless blog software sometime, this version is getting cobwebs.