dgutov / mmm-mode

New official home for mmm-mode, fixed for Emacs >= 23
http://mmm-mode.sourceforge.net/
GNU General Public License v2.0
330 stars 30 forks source link

Major-mode tcl-mode submode nxml-mode: xml indentation broken #79

Open pointsman opened 6 years ago

pointsman commented 6 years ago

Create a buffer with the content

set xml {
<doc>
    <e1>
        <e2>
            <e3>text</e3>
        </e2>
    </e1>
</doc>
}  

and put it in tcl-mode. This lines are a syntactical correct (and by no mean obscure) Tcl command.

Mark the region starting (including) at <doc> and ending (including) </doc>. C-c % C-r, nxml-mode. Region is still active for me, if not for you mark the same region and indent (TAB). I get

set xml {
    <doc>
<e1>
<e2>
<e3>text</e3>
</e2>
</e1>
</doc>
}  

I'd expect:

set xml {
<doc>
  <e1>
    <e2>
      <e3>text</e3>
    </e2>
  </e1>
</doc>
}  

This is with 25.2.1 and mmm-mode version 0.5.4 (without any own mmm-customization, just installed with package.el and tried.

It is just a stripped down example. As far as I see for the combination major-mode tcl-mode submode nxml-mode indentation in nxml submode regions don't work. In the tcl-mode regions indentation works as expected.

dgutov commented 6 years ago

I don't think nxml-mode is able to support this usage yet. You can try (EDIT:) sgml-mode, though.

pointsman commented 6 years ago

Am 12/16/2017 01:57 AM, Dmitry Gutov wrote:

I don't think nxml-mode is able to support this usage yet. You can try xml-mode, though.

I don't think this will be of much help.

emacs -Q

C-h f xml-mode

xml-mode is an alias for ‘nxml-mode’ in ‘nxml-mode.el’.

(xml-mode)

Major mode for editing XML.

May I ask what in nxml-mode is it that hinders it to be used as submode?

dgutov commented 6 years ago

C-h f xml-mode

Like I said in the edit, try sgml-mode.

May I ask what in nxml-mode is it that hinders it to be used as submode?

The full parser, probably. Haven't tried your experiment myself, though.

pointsman commented 6 years ago

Yes, sgml-mode could be used for indentation of embedded xml.

nxml , though, is awful. Well, a working mmm mode is also. Thanks for exploring.