rukano / emacs-faust-mode

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

SMIE hotfix #9

Closed agraef closed 6 years ago

agraef commented 6 years ago

Fix wrong syntax for the quote symbol (1-sample delay in Faust). Also tidy up the syntax table by basing it on the c-mode syntax table which is much closer to lexical Faust syntax.

agraef commented 6 years ago

I had to change this once more, as the syntax table wasn't really in a good shape. E.g., + and - being symbol constituents would throw off auto-complete if you entered something like 1-pan (wouldn't complete to panner no matter what you did, because ac would think that -pan was the symbol to complete, not pan). While this isn't really related to the original issue I'm trying to solve here, it touches on the same code, so it makes sense to just add it to this PR.

It's a separate commit, thus easy to review on its own if anybody is inclined to. So what I did there in the second commit is to just base the syntax table on the C/C++ mode syntax table now, which is almost Faust lexical syntax anyway, and we also get the right comment syntax for free that way.

Also, I'm using "prefix character" as the category for ' now. That gets rid of some unwanted implications of making ' either a word or a symbol constituent. (I'd really like to make this just ordinary punctuation, but that throws off SMIE auto-indentation.)

Sometimes programming elisp is such a kludge fest. 🤦‍

There's one more thing I'm about to add, adding environment to the definition syntax so that it gets the same special treatment that with and letrec already have, so stay tuned.

agraef commented 6 years ago

There's one more thing I'm about to add, adding environment to the definition syntax

I ended up not doing this, because indentation then gets bad if environment gets used inline in a bigger expression. But I did rename faust-outdent-with to faust-outdent-blocks to make clear that it doesn't just apply to with constructs.

Ok, I'm done with this now, I've done some pretty thorough testing and couldn't break it any more, so I'd say that it's ready. Will merge tomorrow if nobody complains.