Skip to content

Using ruby-mode without ruby-electric in Emacs 24.3

Update: This problem only occurs when you install the ruby-mode package from MELPA, which is actually an older version of ruby-mode than ships with Emacs 23. Thanks to dgutov for the hint!

When I upgraded to Emacs 24.3 I noticed that I could not write curly braces anymore in ruby-mode. All I got was this error:

call-interactively: Symbol's value as variable is void: last-command-char

The easiest way to solve this is to use ruby-electric which just replaces the key mapping in ruby-mode with its own mappings (the same error was actually fixed a while ago in ruby-electric).

I am a happy user of autopair so loading ruby-electric messes with my setup. So while I wait for this to be fixed in ruby-mode (pull request), this hack makes curly braces in ruby-mode work again without ruby-electric:

Use the Free Application Namespace in Rails

Lately many people wrote about (the lack of) OOP in Rails. I really enjoyed reading about it, I have certainly not used OOP as much as I should in my Rails code. The discussion encouraged me to write about a change in Rails 3: The Rails application object. A quote from the release notes:

As part of the groundwork for supporting running multiple Rails applications in the same process, Rails 3 introduces the concept of an Application object.

This is great, but somehow nobody mentions that the Application class lives in a module named after your application:

If the point of this was just to support multiple running Rails applications in the same process, the same thing could have been achieved without the module, so there must be a reason for its existence.

Continued…

Tags: ,

Blog

I’ve been feeling bad about not having a blog for some time. Now I have one! I will probably not write anything interesting here.