rukano / emacs-faust-mode

Faust major mode for editing faust code (.dsp files)
13 stars 7 forks source link

SMIE support #8

Closed agraef closed 6 years ago

agraef commented 6 years ago

As promised, I added SMIE support again, using the proper Faust syntax (as much as SMIE allows that). This seems to work reasonably well for me so far, but I'd appreciate it if you can give it a whirl and report any remaining issues so that I can fix them.

While I was at it, I also did some minor touches to the mode description and the README. I think that these are actual improvements, but feel free to ignore those two commits if you don't like them.

rukano commented 6 years ago

@agraef looks good! I can't test the SMIE support right now, but as far as I can read, wouldn't collide with the normal functionality of the mode. Is this correct?

agraef commented 6 years ago

Well, it does affect the auto-indentation (that's its purpose after all!), as well as the structural movement and editing commands forward-sexp, backward-sexp and transpose-sexps, cf. https://www.gnu.org/software/emacs/manual/html_node/elisp/SMIE-setup.html#SMIE-setup. These all seem to work fine AFAICT, except maybe transpose-sexps (but that's pretty much broken also without SMIE, and the sexp commands aren't used all that much by average Emacs users anyway). But note that I can only test all this on Emacs 25.3.1 right now -- I'm on Arch, so I cannot say whether all this works with Emacs 24 or even older versions.

If you (or anyone else here) wants to give it a try, the way you can test this is to just type in examples from the Faust Quick Reference (or any other Faust program) and observe what happens when you hit Enter. That's what I do. :) If the auto-indentation seems weird, just report your test program and the indentation that you'd like to see, and I will see what I can do about it.

I can understand that you feel a bit uneasy about the SMIE stuff -- after all, it was broken in @yassinphilip's version, I was the one who reported that! ;-) All I can say right now is that this version works reasonably well for me, but that it needs more testing. We won't get any really serious testing, though, if we don't unleash it to the public so that Faust programmers can get it in their hands.

One thing I can do is to add a customization variable to switch SMIE support off, would that make you feel better? That's not a big deal, let me quickly augment this PR accordingly...

agraef commented 6 years ago

There you go. So if users find SMIE support broken they can at least switch it off now. :) I'd like to keep this enabled by default, though, so that we do actually get some feedback.

agraef commented 6 years ago

Concerning backward compatibility, unfortunately Emacs 24 doesn't build on Arch any more (segfaults during make), otherwise I'd tested it. The oldest Emacs version that I still have in use is 25.1 (Aquamacs) on my MacBook where this PR works fine as well.

Also, according to Emacs' git log, SMIE has been there forever (since 2010) and hasn't changed all that much recently, so we can be fairly confident that it will work with older versions, too. So I'd say let's go for it! :)

rukano commented 6 years ago

@agraef let's do this! :)