Loading ...
Sorry, an error occurred while loading the content.

Multiple major modes in XHTML

Expand Messages
  • Lennart Borgman
    I just want to say (I believe) I have finally got multiple major modes to work woth nxhtml-mode (derivated from nxml-mode). I had to sacrifice the nxml way of
    Message 1 of 2 , Apr 5, 2007
    • 0 Attachment
      I just want to say (I believe) I have finally got multiple major modes
      to work woth nxhtml-mode (derivated from nxml-mode). I had to sacrifice
      the nxml way of fontifying the xhtml code. Instead I use
      sgml-mode/html-mode for that. I can see no way around this (without
      chaning nxml-mode quite heavily). IMO there is however no big drawback
      using sgml-mode/html-mode for fontifying.

      I guess most of the lurkers here does not mix pure XHTML mode with
      embedded modes very often, but you can now also use nxhtml-mode with php
      for example. Links are here:

      http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html
      http://www.emacswiki.org/cgi-bin/wiki/MuMaMo

      I am however not quite satisfied with this when using php. My
      recommended approach right now is to use nxhtml-part-mode for this, but
      I wish this was a bit better written. I would be glad for some hints here.

      The problem is that the headers needed to get nxml-mode happy enough for
      completion is seldom there in a php file. Currently I solve this by
      adding those headers (hidden) and then remove them when saving the file.

      A much better approach IMO would be to tell the rng parser to start from
      another state. Can someone see any simple way to do this?

      I have been thinking about having another buffer with the headers and
      then get the initial state for parsing the php buffer from that buffer.
      I had not looked into the details - eh, mostly because they are
      complicated. Has someone of you tried this? Or do you have any hints?
    • Lennart Borgman
      ... It was easier than I thought to implement this. I have done that now and that means that the nxml-mode (or the a bit enhanced nxhtml-mode) completion now
      Message 2 of 2 , Apr 9, 2007
      • 0 Attachment
        Lennart Borgman wrote:
        > I just want to say (I believe) I have finally got multiple major modes
        > to work woth nxhtml-mode (derivated from nxml-mode). I had to sacrifice
        > the nxml way of fontifying the xhtml code. Instead I use
        > sgml-mode/html-mode for that. I can see no way around this (without
        > chaning nxml-mode quite heavily). IMO there is however no big drawback
        > using sgml-mode/html-mode for fontifying.
        >
        > I guess most of the lurkers here does not mix pure XHTML mode with
        > embedded modes very often, but you can now also use nxhtml-mode with php
        > for example. Links are here:
        >
        > http://ourcomments.org/Emacs/nXhtml/doc/nxhtml.html
        > http://www.emacswiki.org/cgi-bin/wiki/MuMaMo
        >
        > I am however not quite satisfied with this when using php. My
        > recommended approach right now is to use nxhtml-part-mode for this, but
        > I wish this was a bit better written. I would be glad for some hints here.
        >
        > The problem is that the headers needed to get nxml-mode happy enough for
        > completion is seldom there in a php file. Currently I solve this by
        > adding those headers (hidden) and then remove them when saving the file.
        >
        > A much better approach IMO would be to tell the rng parser to start from
        > another state. Can someone see any simple way to do this?
        >
        > I have been thinking about having another buffer with the headers and
        > then get the initial state for parsing the php buffer from that buffer.
        > I had not looked into the details - eh, mostly because they are
        > complicated. Has someone of you tried this? Or do you have any hints?


        It was easier than I thought to implement this. I have done that now and
        that means that the nxml-mode (or the a bit enhanced nxhtml-mode)
        completion now can be used in buffers with php code that lacks the
        XML+DTD specifications.

        In those buffers you can also have multiple major modes (like php-mode +
        nxhtml-mode).

        I believe it is pretty useful for PHP, JSP and similar modes now. If
        someone is using it for that I would be glad for comments.
      Your message has been successfully submitted and would be delivered to recipients shortly.