Open Procrat opened 6 years ago
Do you think it would be hard to add support for mmm-mode? I'm currently using that to support vue-mode. It seems that other people have had trouble with that in the past: AdamNiederer/vue-mode#52.
Adding support for a new major mode is fairly easy, it is just adding the major mode and the variable to set to this list:
https://github.com/editorconfig/editorconfig-emacs/blob/master/editorconfig.el#L119
I'm not sure if mmm-mode (or vue-mode) is a minor mode or not though, in which case it might add complications.
Let me know if you have questions, and I can try to help you out.
Thanks for the quick response!
mmm-mode is a minor mode that allows for multiple major modes to co-exist in the same buffer. Vue for example has the concept of single file components where HTML, CSS and JS are combined in a single file per reactive component.
Opening up a file with vue-mode (which is based on mmm-mode) will call the hooks of the respective major modes for the different parts of the code that the single component file contains. I noticed however that buffer-file-name
isn't set when it calls those hooks, which EditorConfig needs to match against, right?
We currently always work with major mode. When using vue-mode, I guess you also have to use some js major mode. Is this correct?
I see. That probably makes sense since I don't see how the current EditorConfig syntax can support different settings for the various parts of the same file.
In that case, is it then better to ignore this issue, and perhaps consider supporting vue-mode directly? This currently works for me:
(with-eval-after-load 'editorconfig
(add-to-list 'editorconfig-indentation-alist
'(vue-mode css-indent-offset
js-indent-level
sgml-basic-offset
ssass-tab-width
)))
This is a list of modes that vue-mode currently supports. I didn't look up the indentation settings for all possible submodes. I also don't know if we need anything apart from indentation settings.
I think the simplest solution is to list up all possible offset variables in editorconfig-indentation-alist, as you just wrote above (and IMO it is OK to merge this to this repository).
It is true that it seems to be hard to "support" mmm-mode when buffer-file-name will not be set when it calls mode hooks... Isn't there any way to programatically set buffer-file-name there?
The similar solution can be apply to mhtml-mode
too.
(add-to-list 'editorconfig-indentation-alist
'(mhtml-mode js-indent-level
css-indent-offset
sgml-basic-offset))
Thank you for writing and maintaining this plugin!
Do you think it would be hard to add support for mmm-mode? I'm currently using that to support vue-mode. It seems that other people have had trouble with that in the past: https://github.com/AdamNiederer/vue-mode/issues/52.
I'm not too familiar with Emacs Lisp, but I think the main issue is that the buffer-file-name isn't set for the sub-modes?
Thank you!