Currently it does not indent the following properly: for_foo do |bar| something # <-- indented to col 0 end The problem is ruby-non-block-do-re "\\(while\\|until\\|for\\|rescue\\)\\>" matches 'for_' since '_' is the only valid identifier character that is not an alphanumeric, let's change the re to: (defconst ruby-non-block-do-re "\\(while\\|until\\|for\\|rescue\\)\\>[^_]") YS.