julia-mode.el: Smarter indentation

I've cleaned up and optimised the indentation code. I've also fixed #8924, which sent me on this adventure.

Let me know if you'd rather I squashed these commits, or if there are any changes you'd like.