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 acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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