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

Re: [emacs-nxml-mode] nxml-mode 20041004

Expand Messages
  • Bruce D'Arcus
    A minor thing: I have a long heading that looks like this: Family Values and the Politics of Scale
    Message 1 of 22 , Oct 4, 2004
    • 0 Attachment
      A minor thing:

      I have a long heading that looks like this:

      <section>
      <title><phrase role="socalled">Family Values</phrase> and the
      Politics of
      Scale</title>

      When in outline view, it extends over the end of the line. Seems it
      should be truncated to fit the width of the buffer.

      Bruce
    • Bruce D'Arcus
      So what is outlining in emacs/nxml? Does it only involve display? I ask because -- while this may be difficult/impossible to translate to an XML editor --
      Message 2 of 22 , Oct 4, 2004
      • 0 Attachment
        So what is outlining in emacs/nxml? Does it only involve display?

        I ask because -- while this may be difficult/impossible to translate to
        an XML editor -- when I use dedicated outliners, it is in part to be
        able to easily move around content. So, commands like promote/demote
        are important, as is the ability to quickly move around blocks of
        content with a mouse.

        Re: folding: when I used MS Word and its outline view, I actually liked
        that folding applied to paragraphs too. It allowed me to see the
        structure within sections too.

        Bruce
      • Michael Smith
        ... You mean the title is all on one line, right? And then when you view it in outline mode it gets wrapped to the next line? If that s what you mean, the way
        Message 3 of 22 , Oct 4, 2004
        • 0 Attachment
          Bruce D'Arcus <bdarcus@...> writes:

          > A minor thing:
          >
          > I have a long heading that looks like this:
          >
          > <section>
          > <title><phrase role="socalled">Family Values</phrase> and the
          > Politics of
          > Scale</title>
          >
          > When in outline view, it extends over the end of the line. Seems it
          > should be truncated to fit the width of the buffer.

          You mean the title is all on one line, right? And then when you
          view it in outline mode it gets wrapped to the next line?

          If that's what you mean, the way to keep your Emacs from wrapping
          lines in whatever buffer you're in is with "M-x toggle-truncate-lines"
          (or selecting Options > Truncate Long Lines in this Buffer).

          --Mike
        • peter.lundblad@sorman.com
          ... I agree that if the heading is editable, overriding character keys is a bad idea. But does it have to be editable. I d suggest just extracting text content
          Message 4 of 22 , Oct 4, 2004
          • 0 Attachment
            > -----Original Message-----
            > From: James Clark [mailto:jjc@...]
            > Sent: 04 October 2004 11:35
            >
            >
            > On Mon, 2004-10-04 at 15:00, peter.lundblad@... wrote:
            >
            > > Would it be possible to add more keys when on an outline
            > line, like +
            > > and - to expand/colapse things? I don't know exactly what's
            > allowed by
            > > the Emacs conventions, but easier to type keys would be handy.
            >
            > At the moment the heading in an outline is editable: + will insert a +
            > as usual. I made an exception for RET since the outline only displays
            > the first line of a heading, but I don't think I want to go down the
            > route of overriding the self-insert behavior of normal chars.
            > If there
            > was something like RET, that was very easy to type and whose usual
            > behavior doesn't make much sense in an outlined heading, then we could
            > rebind that. I guess TAB is a possible candidate, but what should it
            > do?
            >

            I agree that if the heading is editable, overriding character keys is a bad idea. But does it have to be editable. I'd suggest just extracting text content from the heading element and removing markup and not making it editable. This would also solve i.e. titles with verbose elements inside also discussed in another reply. Today I had something like
            <title><systemitem class="library">SomeRatherLongLibraryNameThatWeDontWantToBreak</systemitem></title>

            IN that case, the text was more interesting than the markup. Maybe others have counter-examples:-)

            Regards,
            //Peter
          • James Clark
            ... The reason for nxml-section-element-name-regexp is to tell you what a title element is a title of. I want to support structures like:
            Message 5 of 22 , Oct 4, 2004
            • 0 Attachment
              On Mon, 2004-10-04 at 19:25, Michael Smith wrote:

              > In that case, nxml-section-element-name-regexp becomes
              > irrelevant and the only logic is: If I put a title on an
              > element in a particular document, it's an important section of
              > my document, so I want to see it in outline view.

              The reason for nxml-section-element-name-regexp is to tell you what a
              title element is a title of. I want to support structures like:

              <section>
              <info>
              <title>....</title>
              </info>
              <para>...</para>
              </section>

              so I need some way to tell that the title element is a title of the
              section element not the info element.

              A better solution might be to

              a) assume by default that a title element applies to its parent and
              should be included in the outline,

              b) have a regexp for the names of "wrapper" elements, like <info> in the
              above example, and

              c) have a regexp for the names of elements that shouldn't be included in
              the outline even though they have titles.

              A problem is that I currently rely heavily on
              nxml-section-element-name-regexp for performance, so I would need to
              rethink the implementation.

              James
              --
              To send me mail, replace auth-only by public in the from address.
            • Michael Smith
              ... As far as being able to promote/demote, I really think that would be too much to expect from any XML editing program that s designed to let you edit
              Message 6 of 22 , Oct 4, 2004
              • 0 Attachment
                Bruce D'Arcus <bdarcus@...> writes:

                > So what is outlining in emacs/nxml? Does it only involve display?
                >
                > I ask because -- while this may be difficult/impossible to translate to
                > an XML editor -- when I use dedicated outliners, it is in part to be
                > able to easily move around content. So, commands like promote/demote
                > are important, as is the ability to quickly move around blocks of
                > content with a mouse.

                As far as being able to promote/demote, I really think that would
                be too much to expect from any XML editing program that's designed
                to let you edit against any arbitrary schema. It seems like you'd
                need to use a specialized editor designed to work with a specific
                schema. And even then, it would be difficult to implement.

                --Mike
              • Michael Smith
                OK, I didn t actually realize that the outlining code had the ability to look for the title in child elements. So if I understand you correctly, (reliance on
                Message 7 of 22 , Oct 5, 2004
                • 0 Attachment
                  OK, I didn't actually realize that the outlining code had the
                  ability to look for the title in child elements.

                  So if I understand you correctly, (reliance on the performance
                  advantage of nxml-section-element-name-regexp aside for now), you
                  could get rid of nxml-section-element-name-regexp and basically
                  achieve the same effect by defining another regexp for wrapper
                  names (/.*info/ by default, I guess) -- item b in your list below.

                  But I guess I don't understand why you'd need the regexp you
                  mention in item c in your list. It seems like the logic could be:

                  - if you find a title child of a wrapper (info) element, then,
                  in outline view, show that title with the parent element of
                  the info element, regardless of what that parent element is

                  - if you find a title whose parent is NOT an info element, show
                  that parent element with that title

                  Because it seems like the regexp in c would be the same as that in
                  b (in a well-designed grammar, at least). That is, a grammar
                  probably isn't (or probably shouldn't) use the name of a
                  title/heading element as a child of anything except an element
                  that you'd like to have show up in outline view. Are there cases
                  (common XML vocabularies) where it's otherwise.

                  To put this in context for DocBook: All current "metainfo"
                  wrappers in DocBook have names that end in "info" (articleinfo,
                  sectioninfo, etc.), so a default /.*info/ regexp would be fine for
                  working with DocBook current instances.[1]

                  --Mike

                  [1] Just FYI - though DocBook currently allows title as both a
                  child of "sectioning" elements and as a child of an *info
                  element within a sectioning element, in the next major DocBook
                  version, if things go as they've been scoped out by Norm so
                  far, there may be (or probably will be) only one metainfo
                  element -- "info" -- and title will _only_ be allowed as a
                  child of that, and nowhere else. Period.

                  James Clark <jjc@...> writes:

                  > On Mon, 2004-10-04 at 19:25, Michael Smith wrote:
                  >
                  > > In that case, nxml-section-element-name-regexp becomes
                  > > irrelevant and the only logic is: If I put a title on an
                  > > element in a particular document, it's an important section of
                  > > my document, so I want to see it in outline view.
                  >
                  > The reason for nxml-section-element-name-regexp is to tell you what a
                  > title element is a title of. I want to support structures like:
                  >
                  > <section>
                  > <info>
                  > <title>....</title>
                  > </info>
                  > <para>...</para>
                  > </section>
                  >
                  > so I need some way to tell that the title element is a title of the
                  > section element not the info element.
                  >
                  > A better solution might be to
                  >
                  > a) assume by default that a title element applies to its parent and
                  > should be included in the outline,
                  >
                  > b) have a regexp for the names of "wrapper" elements, like <info> in the
                  > above example, and
                  >
                  > c) have a regexp for the names of elements that shouldn't be included in
                  > the outline even though they have titles.
                  >
                  > A problem is that I currently rely heavily on
                  > nxml-section-element-name-regexp for performance, so I would need to
                  > rethink the implementation.
                  >
                  > James
                • James Clark
                  ... If I have something like A B C D E F
                  Message 8 of 22 , Oct 5, 2004
                  • 0 Attachment
                    On Tue, 2004-10-05 at 18:47, Michael Smith wrote:

                    > But I guess I don't understand why you'd need the regexp you
                    > mention in item c in your list.

                    If I have something like

                    <section>
                    <title>A</title>
                    <para>B</para>
                    <note>
                    <title>C</title>
                    <para>D</para>
                    </note>
                    <para>E</para>
                    <section>
                    <title>F</title>
                    <para>G</para>
                    </section>
                    <section>
                    <title>H</title>
                    <para>I</para>
                    </section>
                    </section>

                    I might want my outline to look like

                    A
                    F
                    H

                    rather than

                    A
                    C
                    F
                    H

                    I imagine (c) would match nothing my default.

                    James
                    --
                    To send me mail, replace auth-only by public in the from address.
                  • Thomas Moschny
                    ... Currently, there is no relation between the elements in the section-element-name-regexp and those in the heading-element-name-regexp. It would be nice, if
                    Message 9 of 22 , Oct 5, 2004
                    • 0 Attachment
                      On Monday 04 October 2004 07:37, James Clark wrote:
                      > A new release of nxml-mode is available at:
                      > The main change in this release is support for outlining.

                      Currently, there is no relation between the elements in the
                      section-element-name-regexp and those in the heading-element-name-regexp.
                      It would be nice, if one could instead specify *pairs* of section elements and
                      their respective heading elements.

                      Additionally, the rule

                      > - either its first child element or a descendant of that first child
                      > element has a local name matching the variable
                      > `nxml-heading-element-name-regexp'; and

                      seems too restrictive to me. Sometimes, especially in database-like XML-Files,
                      the title/name/heading element of an element might not be the first child.
                      Would it be possible to accept something like an XPath expression for the
                      heading-element-name?

                      Thomas
                    • Michael Smith
                      ... Why? And would that be assuming a one-to-one relationship between a section element and its heading element? In XHTML, a div may have and h1 heading, or an
                      Message 10 of 22 , Oct 5, 2004
                      • 0 Attachment
                        Thomas Moschny <thomas.moschny@...> writes:

                        > On Monday 04 October 2004 07:37, James Clark wrote:
                        > > A new release of nxml-mode is available at:
                        > > The main change in this release is support for outlining.
                        >
                        > Currently, there is no relation between the elements in the
                        > section-element-name-regexp and those in the heading-element-name-regexp.
                        > It would be nice, if one could instead specify *pairs* of section elements and
                        > their respective heading elements.

                        Why? And would that be assuming a one-to-one relationship between
                        a section element and its heading element? In XHTML, a div may
                        have and h1 heading, or an h2 heading, etc.

                        Anyway, with the exception of XHTML, do you know of any industry
                        standard schemas that don't consistently use the same element name
                        for heading elements? DocBook uses Title exclusively. TEI uses Head.

                        Even in the case of XHTML, it's a simple h[1-6] regexp.

                        > Additionally, the rule
                        >
                        > > - either its first child element or a descendant of that first child
                        > > element has a local name matching the variable
                        > > `nxml-heading-element-name-regexp'; and
                        >
                        > seems too restrictive to me. Sometimes, especially in database-like XML-Files,
                        > the title/name/heading element of an element might not be the first child.
                        > Would it be possible to accept something like an XPath expression for the
                        > heading-element-name?

                        Yipes.
                      • James Clark
                        ... I think a better solution for database-like XML files is to provide the simple folding that has been requested by a few people. Outlining only really has
                        Message 11 of 22 , Oct 6, 2004
                        • 0 Attachment
                          > Sometimes, especially in database-like XML-Files,
                          > the title/name/heading element of an element might not be the first child.

                          I think a better solution for database-like XML files is to provide the
                          "simple" folding that has been requested by a few people. Outlining only
                          really has substantial advantages over simple folding for document-like
                          XML documents with complex, recursive structure; for these I think the
                          assumption that the title is or is a descendant of the first child
                          element is acceptable. I want to move in the direction of reducing the
                          amount of configuration users have to do to get reasonable results.

                          James
                        • Peter Heslin
                          ... And some of us would like to use the simple folding in addition to outlining on document-like documents, too. Peter
                          Message 12 of 22 , Oct 6, 2004
                          • 0 Attachment
                            On 2004-10-06, James Clark <jjc@...> wrote:
                            >
                            >
                            > > Sometimes, especially in database-like XML-Files,
                            > > the title/name/heading element of an element might not be the first child.
                            >
                            > I think a better solution for database-like XML files is to provide the
                            > "simple" folding that has been requested by a few people.

                            And some of us would like to use the "simple" folding in addition to
                            outlining on document-like documents, too.

                            Peter
                          • Norman Walsh
                            ... I suggest that if div is in the section list, nxml-heading-element-name-regexp should include |h1 |h2 |h3 |h4 |h5 |h6 by default. I haven t used the
                            Message 13 of 22 , Oct 20, 2004
                            • 0 Attachment
                              / James Clark <jjc@...> was heard to say:
                              | Those three conditions *all* have to be satisfied before its treated as
                              | a section.

                              I suggest that if 'div' is in the section list,
                              nxml-heading-element-name-regexp should include
                              \|h1\|h2\|h3\|h4\|h5\|h6 by default. I haven't used the folding mode
                              very much, but I was definitely confused momentarily when I tried it
                              in an HTML document and it didn't "do the right thing".

                              If it hasn't already happened, someone is eventually going to suggest that
                              I should be able to specify values for these variables as annotations in
                              the schema being used for validation, so I'll just mention that now :-)

                              Be seeing you,
                              norm

                              --
                              Norman Walsh <normyahoo@...> | Endurance is frequently a form of
                              http://nwalsh.com/ | indecision.--Elizabeth Bibesco
                            Your message has been successfully submitted and would be delivered to recipients shortly.