Indentation in PSGML...

  • chris warth
    chris warth

    I can't seem to get any indentation to work in SGML-mode (or xml-mode).  The indent-step under SGML->File Optionsis set to 2.  When I tab, nothing changes. calling 'indent-region' does nothing. 

    Is that because there is some parse error earlier in the buffer?  Or did I just forget to set some variable?

    • Short answer, try setting (in .emacs):

      (setq-default sgml-indent-data t)

      In SGML and in valid XML there are some context (elements) that only allows elements and where white space is ignored and some contexts where data is allowed and white space is significant. Wheter or not data is allowed can be determined from the DTD. If sgml-indent-data is nil, PSGML will not indent where data is allowed (and therefore the indentation will become significant white space). This is the default setting. Using XML with out a DTD, PSGML will assume that data is allowed in all elements.

    • Niko Schmuck
      Niko Schmuck

      With setting the variable 'sgml-indent-data' i have still problems for an XML instance w/o a DTD and proper indentation. For example my instance looks like:

      <?xml version="1.0">

      My key bindings are:
      RET runs `newline-and-indent'
      TAB runs `sgml-indent-or-tab'

      Thanks for any help in advance,

      • That works for me (if I fix the xml declaration that should end with '?>' not '>').