hylang / hy-mode

Hy mode for Emacs
GNU General Public License v3.0
189 stars 48 forks source link

Only first argument in (setv ...) is font-locked #68

Closed bennyandresen closed 6 years ago

bennyandresen commented 6 years ago

setv can assign multiple variables http://docs.hylang.org/en/stable/language/api.html#setv

ekaschalk commented 6 years ago

This is a known bug. At the time I didn't know enough about font-locking to do it, but I think I know how to now.

I appreciate the raised issues, I'll address them this weekend. I've been moving so very busy lately.

bennyandresen commented 6 years ago

Don't worry about the time-frame, I just thought I better raise them while I encounter them so I don't forget myself.

ekaschalk commented 6 years ago

14100975b8321a3f2ab99fa04b252ee9cc0ec351 Should be fixed in master now.

bennyandresen commented 6 years ago

Works on the simple case like

(setv foo (bar)
      baz 'quux)

but breaks for some reason on this:

(setv foo (.bar baz)
      frob (quux))
ekaschalk commented 6 years ago

I succeeded using a different mechanism than font-locks, syntax-propertize-function.

However, it is inconsistent in updating the highlighting. Edits will cause the highlighting to basically toggle on some of the form's lines. First activating hy-mode will apply the correct highlighting every time.

I can try but it is likely not simple to resolve. This kind of highlighting is more complex than any other I'm aware of.

bennyandresen commented 6 years ago

That's unfortunate. I don't think this is high priority, I would be fine to revert to the behavior before 1410097 as that resulted in less random highlighting.

ekaschalk commented 6 years ago

I've put more work in and it's working, see http://www.modernemacs.com/post/advanced-syntax/

However, it's still not 100% on large files and might require edits here and there for various highlighting to take effect.

I might look into it, but it's at least possible in theory.

ekaschalk commented 6 years ago

Going to close this issue as I do not think the performance cost of multi-line highlighting is worth it, even if I get the code working in 100% of cases.

I've picked up the habit of using setv with only one clause, a way to avoid the annoyance.