Re: Indentation problem

Matt Armstrong <[email protected]>
Newsgroups gmane.emacs.psgml.user
Message-ID <[email protected]>
Matt Armstrong <[email protected]> writes:
> I'm running into an indentation problem with psgml 1.2.5.
> 
> The beginning of my document looks like this:
> 
> <?xml version="1.0"?>
> <!DOCTYPE wml SYSTEM "/home/maarmstr/dtd/wml13.dtd">
> <wml>
>   <card title="Compose This">
>      <p>
> <select>
> 
> PSGML thinks that <select> should begin on the first column.  Tracing
> through the code I find that sgml-indent-line bails when trying to come
> up with an indentation for the <select> tag because sgml-element-data-p
> returns true for the <p> element.
> 
> Translation: it seems like PSGML does not want to indent an element if
> its enclosing element can contain text (CDATA).  This is the case for
> the DTD I'm using.
> 
> Is this true of PSGML?
> 
> If so, how do you get reasonable indentation in cases like this?

I have fixed this with the following incomplete hack.  If with this,
PSGML will always at least use sgml-content-indent-function.  This is
broken because end tags for such elements (like <p>) seem to be indented
as if they were content.  E.g.

<wml>
  <card title="Compose This">
    <p>
      <select>
        ...
        ...
      </select>
      </p>
  </card>
</wml>


*** psgml-edit.el       Fri Sep 20 12:55:49 2002
--- /users/maarmstr/download/psgml-1.2.5/psgml-edit.el  Fri Apr 19 11:37:46 2002
***************
*** 414,424 ****
                ((or sgml-indent-data
                     (not (sgml-element-data-p element-insert)))
                 (setq col
!                      (funcall sgml-content-indent-function element-level)))
!             (t
!              ;; This seems to fix problems with indenting entities
!              ;; within tags that can contain CDATA.
!              (setq col (sgml-indent-according-to-level element-insert)))))
        (when (and col (/= col (current-column)))
        (beginning-of-line 1)    
        (delete-horizontal-space)
--- 414,420 ----
                ((or sgml-indent-data
                     (not (sgml-element-data-p element-insert)))
                 (setq col
!                      (funcall sgml-content-indent-function element-level)))))
        (when (and col (/= col (current-column)))
        (beginning-of-line 1)    
        (delete-horizontal-space)


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.