1

In some of my ruby files, mostly Rails Model files, I often encounter lines such as:

  validates :thing_id, presence: { message: '^Choose a Thing' },
    on: :create, 
    unless: Proc.new { |obj| ... some condition ... }

Where the unless: is treated like the unless directive, and so throws the indentation off for the rest of the file. This also happens with an if: option.

Has anyone found a solution for this?

tamouse
  • 135
  • 4

1 Answers1

2

You're probably using the legacy indentation code, enabled with (setq ruby-use-smie nil).

Set that variable to t (its default), restart Emacs, and the problem will disappear.

Dmitry
  • 3,508
  • 15
  • 20