Taking a closer look, there are definitely cases I didn't use that behave strangely. As I see it, there are four causes for this.
The first is an incomplete treatment of similar constructs that should be indented the same way, e.g. datatype, dataprop, dataviewtype... I thought I had gotten this working, but I didn't test every keyword. The second is things that indent strangely at first, but indent correctly after entering calling newline-and-indent. This behavior is mildly annoying, but it is also inherited from the original SML mode and can be fixed with semicolon usage. I'm not sure SMIE is powerful enough to eradicate this behavior. The third is flat out bugs. For example, different styles of datatype declaration break indentation (i.e. | Foo of (a,b) vs | Foo() of (a,b)). The fourth is my preferred indentation style, which uses much longer lines than yours. I find it painful to read such short lines of code, and so I didn't test that case very much. For example, I would write fun {n:nat} factorial(n:int(n)): [r:int] (FACTORIAL(n,r) | int(r)) Do you have any particular examples that stood out as being incorrect? I will continue working on this for my own use, at least :) On Thursday, October 12, 2017 at 5:58:02 AM UTC-7, gmhwxi wrote: > > I gave it a try last night. I encountered many cases of excessive > indentation. > > The syntax of ATS is rich and complex. So it makes sense to require the > programmer > to manually add indentation. With the current ats-mode, you get two spaces > if you hit the > tab key. So you are pretty much in control of indentation. As far as I > know, a lot of programmers > want this kind of control :) > > > On Wed, Oct 11, 2017 at 3:43 PM, Andrew Knapp <andy.j...@gmail.com > <javascript:>> wrote: > >> Hello all, >> >> By cannibalizing sml.el, I have largely gotten automatic indentation >> working in ATS. >> >> After a few months of sporadic use, the only problem I couldn't fix is >> excessive indentation after a function has ended. >> This can be fixed by terminating all functions with semicolons, which is >> ugly, but it seems to work. >> If you don't do this, you have to type "fun" and then hit tab to indent >> properly. >> >> Perhaps someone with more experience with programming languages can fix >> this, since I have no background with parsers. >> (The code is based on Emacs' SMIE, which uses operator precedence >> grammars.) >> >> Here is the temporary link. Let me know what I need to do to get this >> upstream. >> >> https://github.com/ajknapp/ats-mode-indent >> >> Best, >> Andrew Knapp >> >> -- >> You received this message because you are subscribed to the Google Groups >> "ats-lang-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to ats-lang-user...@googlegroups.com <javascript:>. >> To post to this group, send email to ats-lan...@googlegroups.com >> <javascript:>. >> Visit this group at https://groups.google.com/group/ats-lang-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ats-lang-users/ad0158e6-35c0-4a98-9aff-13d9a27578a6%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ats-lang-users/ad0158e6-35c0-4a98-9aff-13d9a27578a6%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > > -- You received this message because you are subscribed to the Google Groups "ats-lang-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to ats-lang-users+unsubscr...@googlegroups.com. To post to this group, send email to ats-lang-users@googlegroups.com. Visit this group at https://groups.google.com/group/ats-lang-users. To view this discussion on the web visit https://groups.google.com/d/msgid/ats-lang-users/ded6ee30-3dfd-499a-ae2c-6afb8b074318%40googlegroups.com.