fgallina/multi-web-mode

Doesn't really work without (multi-web-global-mode 1)

Opened this issue · 1 comments

Hello,

First of all thanks, I think this is the first multi-mode emacs plugin I try that I find nice & simple.

Now my problem: if I don't use multi-web-global-mode, for example with coffee-mode and erb, then it always "jumps out" of multi-web-mode:

(defun multi-web-mode-coffee-erb ()
  (setq mweb-default-major-mode 'coffee-mode)
  (setq mweb-tags '((ruby-mode "<%==\\|<%=\\|<%#\\|<%" "%>")))
  (setq mweb-filename-extensions '("erb"))
  (multi-web-mode))

(add-to-list 'auto-mode-alist '("\\coffee\\.erb\\'" . multi-web-mode-coffee-erb))

After some investiguation, I see that in mweb-change-major-mode when it changes mode (calls ruby-mode) then multi-web-mode is disabled, and one has to call M-x multi-web-mode again to reenable it... which will work until you change mode again.

[EDIT] I just checked and this also happens in plain PHP/HTML mode.

Also the "hook" solution doesn't really work either... consider

(add-hook 'css-mode-hook 'multi-web-mode)

This works inside an html page... but fails when you open a .css file because there's no enclosing style tag.