Open
Description
Sorry for all the edits, I accidentally pressed enter while typing the title.
This is similar to issue #102, but instead of going two levels, I need to go any number of levels deep.
Here is the sample code:
As you can see the html where is cursor is is lisp-mode, while it should be html-mode.
Here is is as text:
(write-html
<html>
<head>
<link rel="stylesheet" href="/site.css" />
<title>,(progn title) - New Poll</title>
</head>
<body>
<header>
<h1 id="title">,(progn title)</h1>
</header>
<form method="POST" action="/new-poll">
,@(when (null names)
(list <input-name index="0" name="" />
<input-name index="1" name="" />
<input-name index="2" name="" />))
,@(mapcar (lambda (name i)
<input-name index=i name=name />)
names (enumerate names))
,(when (string= action "add")
<input-name index=(length names) name="" />)
,(when errors <ul class="error"> ,@errors </ul>)
<button name="action" type="submit" value="add">Add</button>
<button name="action" type="submit" value="submit">Submit</button>
</form>
<hr />
<footer>
</footer>
</body>
</html>)
Here is my MMM config:
(require 'sgml-mode)
(require 'lisp-mode)
(require 'mmm-mode)
;; add preferences for relevant modes
(mmm-add-to-major-mode-preferences 'lisp 'lisp-mode t)
(mmm-add-to-major-mode-preferences 'html 'html-mode t)
(defun html-back-matcher ()
(forward-char -2)
(with-syntax-table html-mode-syntax-table
(sgml-skip-tag-forward 1))
0)
(defun lisp-back-matcher ()
(forward-char -1)
(with-syntax-table lisp-mode-syntax-table
(forward-sexp))
0)
(mmm-add-classes
'((mmm-lisp
:submode lisp
:face mmm-declaration-submode-face
:front ",(\\|,@\\|=("
:include-front t
:back "."
:back-offset (lisp-back-matcher))))
(mmm-add-mode-ext-class 'lisp-mode nil 'mmm-lisp)
(mmm-add-classes
'((mmm-html
:submode html
:face mmm-declaration-submode-face
:front "\\(?1:<\\)[^=[:space:]]"
:front-match 1
:include-front t
:back "."
:back-offset (html-back-matcher))))
(mmm-add-mode-ext-class 'lisp-mode nil 'mmm-html)
Basically, what I would like is for the mmm-modes to be applied recursively until there isn't another one found.
Metadata
Metadata
Assignees
Labels
No labels