To bring the thread back around full-circle to the topic of SMIE...
Stefan I wound up rewriting the `forward-token' and `backward-token' functions, discarding the previous code (which I inherited) in favor of much simpler, more concise code I found in `ruby-mode' and `swift-mode'. I took up this project (
https://github.com/elixir-lang/emacs-elixir) just a couple months ago, so I thought the convolution of the code I replaced was a result of SMIE. I was skeptical about the degree to which I would be able to simplify the logic.
However, after cutting out over 150 lines of code by leaning heavily on SMIE, I just wanted to say thanks. SMIE -- once you get it -- is really valuable. There's a learning curve for sure, but it's a really pragmatic tool.
To any future readers who are looking for guidance on how to implement SMIE-driven indentation in your language mode, below are a few links of simple, concise, valid SMIE implementations that can serve as reference. In order of simplicity (IMO):
elixir-mode:
swift-mode:
ruby-mode: