In Emacs, toggle ruby hash syntax between classic and 1.9 styles
Emacs Lisp
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Melpa Status Melpa Stable Status Support me


Adapted from the method used by TextMate, this library provides a command ruby-hash-syntax-toggle which attempts to automatically convert the selected region of ruby code between 1.8 and 1.9 hash styles.


If you choose not to use one of the convenient packages in MELPA, you'll need to add the directory containing ruby-hash-syntax.el to your load-path, and then (require 'ruby-hash-syntax).


Add the following to your emacs init file:

(require 'ruby-hash-syntax)

Then select a block of ruby code containing a hash literal (perhaps using mark-sexp), and run the ruby-hash-syntax-toggle command:

M-x ruby-hash-syntax-toggle

You might like to bind that command to a key in ruby-mode-map.

Steve Purcell's blog // @sanityinc on Twitter