8000 Feature Request: Infinite Nesting · Issue #113 · dgutov/mmm-mode · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Feature Request: Infinite Nesting #113
Open
@charJe

Description

@charJe

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:
Screenshot from 2020-08-21 23-00-45
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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0