Attribute Indentation

2002-10-08
2002-10-15
  • Charles Chan
    Charles Chan
    2002-10-08

    Hi, I would like to indent my attributes like this:

    <company name="Test"
                     id="10"
                     owner="TestOwner"/>

    The proportional font might not work very well in this case. Anyway, you get the idea, basically , I want to align the attributes together on the same column. I have been searching thru the web and couldn't find any solution.

    Any help is appreciate,
    Charles

     
    • Charles Chan
      Charles Chan
      2002-10-08

      Oops, the spaces are all removed, so let me try again:

      <company name="Test"
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;id="10"/>

       
    • There is no "offical" support for this. But I once stared writing a more flexible indentation code. What you can do is set the undocumented variable sgml-attribute-indent-function to the function sgml-indent-according-to-stag-end.

      (setq sgml-attribute-indent-function 'sgml-indent-according-to-stag-end)

       
    • Charles Chan
      Charles Chan
      2002-10-15

      Oh, dear, I love you. It works! :)