canatella / bitbake-el

Integrates Bitbake into emacs
GNU General Public License v3.0
9 stars 15 forks source link

Improve matching of python sections in mmm-mode & change default-tab-width to tab-width #15

Closed xantoz closed 2 years ago

xantoz commented 4 years ago

Just some things that occurred to me when I started using this (mostly to get syntax highlighting working ok).

Still a bit of a WIP. There's some more improvement that could be done to use character classes in the existing regexes (like [:alnum:]).

I also get the following warning message directly after switching to mmm-mode. This started happening after my changes to matching of bitbake-shell and bitbake-python:

font-lock-fontify-keywords-region: Marker does not point anywhere

Despite this warning I don't see any big issues, except fontlock sometimes getting confused around the borders of python regions (but that seems to have been happening before as well), and not updating the syntax highlighting until you modify the code around it a bit.

canatella commented 4 years ago

The error message might be related to this https://github.com/purcell/mmm-mode/issues/56 ?

xantoz commented 4 years ago

Changed the regex defvars to defconst, since they're really not runtime-changeable by rebinding the values of bitbake-shell-regex, bitbake-python-regex and bitbake-python-def-regex. The regexes get baked in by the backtick quote just before the mmm-add-classes function is called. (Technically if you could modify the regex string in place, without rebinding, it might work since both the variable and the value after :front in the alist cell should by referencing the same string object)

To have them be properly runtime customizeable would require some sort of hook on variable change that would replace/modify the class definitions in mmm-classes-alist, which seems like a lot of work for something that hopefully shouldn't need to be customized by the end user anyway.

xantoz commented 4 years ago

The error message might be related to this purcell/mmm-mode#56 ?

Seems like it. Disabling my whitespace-mode hook stopped the error message from appearing.

xantoz commented 4 years ago

Btw, a good example file for testing this is openembedded-core/meta/classes/image.bbclass (for the record I'm on 6fa967f194edd314c9026c80f8d93360ac6d9efa)

Link: https://git.openembedded.org/openembedded-core/tree/meta/classes/image.bbclass

canatella commented 4 years ago

I don't have the opportunity to test at the moment, I'm on macos rn and I have no easy way to test but this looks okay to me, did you run the test suite ?

xantoz commented 4 years ago

did you run the test suite ? How do I run it?

canatella commented 4 years ago

cask exec ert-runner

canatella commented 4 years ago

Thank you! could you just confirm the tests are passing cask exe ert-runner and if you feel like it, add yourself to the contributors list. I'll merge this then.

canatella commented 2 years ago

Thank you!