Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for mmm-mode #169

Open
Procrat opened this issue Jul 19, 2018 · 7 comments
Open

Support for mmm-mode #169

Procrat opened this issue Jul 19, 2018 · 7 comments

Comments

@Procrat
Copy link

Procrat commented Jul 19, 2018

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: AdamNiederer/vue-mode#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!

@jgkamat
Copy link
Contributor

jgkamat commented Jul 20, 2018 via email

@Procrat
Copy link
Author

Procrat commented Jul 20, 2018

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?

@xuhdev
Copy link
Member

xuhdev commented Jul 20, 2018

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?

@Procrat
Copy link
Author

Procrat commented Jul 20, 2018

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
                          )))

@Procrat
Copy link
Author

Procrat commented Jul 20, 2018

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.

@10sr
Copy link
Member

10sr commented Jul 23, 2018

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?

@wsw0108
Copy link

wsw0108 commented Jul 16, 2021

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))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants