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?

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.