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

nxml-mode features I'd like to see

Expand Messages
  • John W. Shipman
    I ve now written a few small documents with nxml-mode. Bravo to James Clark! Very nice package. I m using the 2003-10-31 version. I m a longtime user of
    Message 1 of 9 , Jun 16, 2004
    • 0 Attachment
      I've now written a few small documents with nxml-mode. Bravo to
      James Clark! Very nice package. I'm using the 2003-10-31
      version.

      I'm a longtime user of psgml-emacs. Here's a list of some of the
      features of psgml that I missed while building documents with
      nxml. They're listed under the psgml key bindings just for
      reference, but the specific key bindings don't matter to me.


      C-c Enter
      ---------

      Split the element containing the cursor. I use this a lot to
      start a new paragraph, turning this text (^^^=cursor)

      <para>
      Text text text...^^^
      </para>

      into this text:

      <para>
      Text text text...
      </para>
      <para>
      ^^^
      </para>


      C-c C-d
      -------

      Move the cursor to the next place where text can go. Example,
      before:

      <userinput><replaceable>x^^^</replaceable></userinput>

      After using once:

      <userinput><replaceable>x</replaceable>^^^</userinput>

      After using twice:

      <userinput><replaceable>x</replaceable></userinput>^^^


      M-C-a
      -----

      Jump the cursor to the beginning of the current element. Example
      before:

      <para>
      Blah blah...
      ...blah ^^^ blah...
      ...blah blah.
      </para>

      After:

      <para>^^^
      Blah blah...
      ...blah blah...
      ...blah blah.
      </para>


      M-C-e
      -----

      Jump the cursor to the end of the current element. Same example
      as above, after:

      <para>
      Blah blah...
      ...blah ^^^ blah...
      ...blah blah.
      </para>

      After:

      <para>^^^
      Blah blah...
      ...blah blah...
      ...blah blah.
      ^^^</para>


      M-C-u
      -----

      Jump the cursor before the beginning of the current element.
      Very useful in jumping from deeply nested tags (like the
      middle of a <table>) to higher containing elements (like the
      beginning of a <section>).


      C-c -
      -----

      Remove the element containing the cursor, leaving the content.
      Before:

      <emphasis>Blah ^^^ blah</emphasis>

      After:

      Blah ^^^ blah

      This is great for situations where I tag something with the wrong
      element type.


      C-c C-r
      -------

      Wrap the region with an element. Prompts in the minibuffer for
      the element name, with completion, then puts an opening tag
      just before the region and a closing tag just after the region.


      C-c C-a
      -------

      Splits the screen and shows, in the other window, all possible
      attributes of the element containing the cursor. This is more of
      a luxury feature than the ones mentioned above, but it's very
      handy to see not only the valid attribute names (which nxml will
      give me in response to the completion command) but, in the case
      of enumerated attributes, the possible values.


      Features I'd like to see
      ------------------------

      How do I customize colors?


      Documentation missing
      ---------------------

      I'm using the nxml-mode.info file to find out how to use this
      package, but the article on this Web page mentions some features
      that are not discussed in the info file:

      http://www.xmlhack.com/read.php?item=2061

      In particular, I couldn't find a mention of the C-c C-n command
      to jump to the next invalid point, or C-M-\ (indent-region).


      ================================================================

      Thanks again for a great package. I will be using it in production
      from now on, even if no additional features are added. But the
      features above would make my work go a lot faster.

      Best regards,
      John Shipman (john@...), Applications Specialist, NM Tech Computer Center,
      Speare 128, Socorro, NM 87801, (505) 835-5950, http://www.nmt.edu/~john
      ``Let's go outside and commiserate with nature.'' --Dave Farber
    • Reinout van Rees
      ... As I made quite a few xslt stylesheets, I used the xslide mode in emacs. Even for plain xml, as it had one incredible useful feature: when you typed in
      Message 2 of 9 , Jun 16, 2004
      • 0 Attachment
        On Wed, 16 Jun 2004, John W. Shipman wrote:

        > I'm a longtime user of psgml-emacs. Here's a list of some of the
        > features of psgml that I missed while building documents with
        > nxml.

        As I made quite a few xslt stylesheets, I used the "xslide" mode in
        emacs. Even for plain xml, as it had one incredible useful feature:
        when you typed in '</' it auto-completed with the current element that
        could be closed.

        No key bindings. Just doing what you have to type anyway and, tadaaah,
        it works.



        Now I have to admit that my current emacs-lisp experience is limited
        to copy-pasting stuff into my .emacs, so I can't figure it out (at the
        moment) myself. If somebody has something copy-pastable it would make
        me quite happy, but it can wait till I learned enough emacs-lisp :-)

        Reinout

        --
        Reinout van Rees - reinout@...
        http://vanrees.org/
        "Eagles may soar, but weasels don't get sucked into jet engines."
      • Michael Smith
        Hi Reinout, You wrote: [...] ... Turning on the Nxml Slash Auto Complete Flag option (setting the nxml-slash-auto-complete-flag variable to t ) will give
        Message 3 of 9 , Jun 16, 2004
        • 0 Attachment
          Hi Reinout,

          You wrote:

          [...]

          > As I made quite a few xslt stylesheets, I used the "xslide" mode in
          > emacs. Even for plain xml, as it had one incredible useful feature:
          > when you typed in '</' it auto-completed with the current element that
          > could be closed.
          >
          > No key bindings. Just doing what you have to type anyway and, tadaaah,
          > it works.

          Turning on the "Nxml Slash Auto Complete Flag" option (setting the
          nxml-slash-auto-complete-flag variable to "t") will give you the same
          behavior in nXML.

          But the default behavior (without that option set) is almost as easy to
          use: You first type '</' and then type C-RET. Just one extra keystroke.

          I think I rememember James saying that he didn't want to make the "auto
          complete after slash" behavior the default because it's not consistent
          with the "normal" way things work in Emacs.

          > Now I have to admit that my current emacs-lisp experience is limited
          > to copy-pasting stuff into my .emacs, so I can't figure it out (at the
          > moment) myself. If somebody has something copy-pastable it would make
          > me quite happy, but it can wait till I learned enough emacs-lisp :-)

          To customize nXML behavior, you don't need to manually do any copy-
          pasting of stuff into your .emacs. There's a really easy-to-use
          customization interface already built in. To access it, all you need to
          do is type:

          M-x customize-group RET nxml RET
        • Michael Smith
          Hi John, Some of the PSGML features you mention have been brought up on the list previously, but not been implemented yet. But I think some of the others are
          Message 4 of 9 , Jun 17, 2004
          • 0 Attachment
            Hi John,

            Some of the PSGML features you mention have been brought up on the list
            previously, but not been implemented yet. But I think some of the others
            are actually available in nXML already.

            You wrote:

            [...]

            > I'm a longtime user of psgml-emacs. Here's a list of some of the
            > features of psgml that I missed while building documents with
            > nxml. They're listed under the psgml key bindings just for
            > reference, but the specific key bindings don't matter to me.

            [...]

            > C-c C-d
            > -------
            >
            > Move the cursor to the next place where text can go. Example,
            > before:
            >
            > <userinput><replaceable>x^^^</replaceable></userinput>
            >
            > After using once:
            >
            > <userinput><replaceable>x</replaceable>^^^</userinput>
            >
            > After using twice:
            >
            > <userinput><replaceable>x</replaceable></userinput>^^^

            You can get that using C-M-f to go forward and C-M-b to go back.

            > M-C-a
            > -----
            >
            > Jump the cursor to the beginning of the current element. Example
            > before:
            >
            > <para>
            > Blah blah...
            > ...blah ^^^ blah...
            > ...blah blah.
            > </para>
            >
            > After:
            >
            > <para>^^^
            > Blah blah...
            > ...blah blah...
            > ...blah blah.
            > </para>

            hmm, that seems the same as doing C-M-b

            > M-C-e
            > -----
            >
            > Jump the cursor to the end of the current element. Same example
            > as above, after:
            >
            > <para>
            > Blah blah...
            > ...blah ^^^ blah...
            > ...blah blah.
            > </para>
            >
            > After:
            >
            > <para>^^^
            > Blah blah...
            > ...blah blah...
            > ...blah blah.
            > ^^^</para>

            and that seems same as doing C-M-f

            > M-C-u
            > -----
            >
            > Jump the cursor before the beginning of the current element.
            > Very useful in jumping from deeply nested tags (like the
            > middle of a <table>) to higher containing elements (like the
            > beginning of a <section>).

            That same combo in nXML should give you exactly the same behavior as
            what you describe.

            [...]

            > C-c C-a
            > -------
            >
            > Splits the screen and shows, in the other window, all possible
            > attributes of the element containing the cursor. This is more of
            > a luxury feature than the ones mentioned above, but it's very
            > handy to see not only the valid attribute names (which nxml will
            > give me in response to the completion command) but, in the case
            > of enumerated attributes, the possible values.

            But nXML will also give you any enumerated valued in response to the the
            completion command.

            > Features I'd like to see
            > ------------------------
            >
            > How do I customize colors?

            M-x customize-group RET nxml-highlighting-faces RET

            > Documentation missing
            > ---------------------
            >
            > I'm using the nxml-mode.info file to find out how to use this
            > package, but the article on this Web page mentions some features
            > that are not discussed in the info file:
            >
            > http://www.xmlhack.com/read.php?item=2061

            Hey, that looks familiar...

            > In particular, I couldn't find a mention of the C-c C-n command
            > to jump to the next invalid point, or C-M-? (indent-region).

            You can get short descriptions of all key binding by doing:

            M-x describe-bindings RET

            C-c C-n rng-next-error

            The C-M-<backslash> combo is a global Emacs binding for indent-region,
            not specific to nXML.

            Hope that helps,

            --Mike
          • drkm
            ... Yep. Similarilly, I think `rng-next-error() should be bound to `C-x ` , the normal Emacs binding to `next-error() , should it not ? And maybe this
            Message 5 of 9 , Jun 17, 2004
            • 0 Attachment
              Michael Smith <smith@...> writes:

              >> In particular, I couldn't find a mention of the C-c C-n command
              >> to jump to the next invalid point, or C-M-? (indent-region).

              > You can get short descriptions of all key binding by doing:

              > M-x describe-bindings RET

              > C-c C-n rng-next-error

              > The C-M-<backslash> combo is a global Emacs binding for indent-region,
              > not specific to nXML.

              Yep.

              Similarilly, I think `rng-next-error()' should be bound to `C-x `',
              the normal Emacs binding to `next-error()', should it not ? And maybe
              this command should use `compilation-parse-errors-function' and
              `compilation-error-list', to be consistant with facilities provided by
              Emacs to find out and move to the next « compilation error ».

              --drkm
            • drkm
              ... Really ?-) --drkm
              Message 6 of 9 , Jun 17, 2004
              • 0 Attachment
                Reinout van Rees <reinout@...> writes:

                > As I made quite a few xslt stylesheets, I used the "xslide" mode in
                > emacs. Even for plain xml, as it had one incredible useful feature:
                > when you typed in '</' it auto-completed with the current element that
                > could be closed.

                > No key bindings.

                Really ?-)

                --drkm
              • Reinout van Rees
                ... Thanks, works like a charm. Reinout -- Reinout van Rees - reinout@vanrees.org http://vanrees.org/ What you do today will cost you a day of your life.
                Message 7 of 9 , Jun 17, 2004
                • 0 Attachment
                  On Thu, 17 Jun 2004, Michael Smith wrote:

                  > > when you typed in '</' it auto-completed with the current element that
                  > > could be closed.
                  >
                  > Turning on the "Nxml Slash Auto Complete Flag" option (setting the
                  > nxml-slash-auto-complete-flag variable to "t") will give you the same
                  > behavior in nXML.

                  Thanks, works like a charm.

                  Reinout

                  --
                  Reinout van Rees - reinout@...
                  http://vanrees.org/
                  "What you do today will cost you a day of your life."
                • Vincent Lefevre
                  ... Typing C-c C-f (without - Web: 100% validated (X)HTML - Acorn /
                  Message 8 of 9 , Jun 17, 2004
                  • 0 Attachment
                    On 2004-06-17 15:55:01 +0900, Michael Smith wrote:
                    > But the default behavior (without that option set) is almost as easy to
                    > use: You first type '</' and then type C-RET. Just one extra keystroke.

                    Typing C-c C-f (without </ first) is even easier.

                    --
                    Vincent Lefèvre <vincent@...> - Web: <http://www.vinc17.org/>
                    100% validated (X)HTML - Acorn / RISC OS / ARM, free software, YP17,
                    Championnat International des Jeux Mathématiques et Logiques, etc.
                    Work: CR INRIA - computer arithmetic / SPACES project at LORIA
                  • DuCharme, Bob (LNG-CHO)
                    I missed most of the same ones, so I have the macros below to do some of them. Bob ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                    Message 9 of 9 , Jun 18, 2004
                    • 0 Attachment
                      I missed most of the same ones, so I have the macros below to do some of them.
                       
                      Bob
                       
                      ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                       
                      (defun nxml-beginning-of-element ()
                        "Jump to point after start-tag."
                        (interactive)
                        (nxml-backward-up-element)
                        (forward-sexp)
                      )
                      (global-set-key [?\C-c (home)] 'nxml-beginning-of-element)
                       

                      (defun nxml-end-of-element ()
                        "Jump to point before end-tag."
                        (interactive)
                        (nxml-up-element)
                        (backward-sexp)
                      )
                      (global-set-key [?\C-c (end)] 'nxml-end-of-element)
                       
                      ; Split element:
                      ; From 2004-05-17 e-mail to nxml-list
                      (defun cabo:nxml-split-element ()
                         (interactive "*")
                         (nxml-finish-element)
                         (insert "\n<" (xmltok-start-tag-qname) ">")
                         (nxml-indent-line))
                       
                        (define-key nxml-mode-map "\C-c\C-m" 'cabo:nxml-split-element)
                       

                      From: John W. Shipman [mailto:JOHN@...]
                      Sent: Thursday, June 17, 2004 12:58 AM
                      To: nXML mailing list
                      Cc: John Shipman
                      Subject: [emacs-nxml-mode] nxml-mode features I'd like to see

                      I've now written a few small documents with nxml-mode.  Bravo to
                      James Clark!  Very nice package.  I'm using the 2003-10-31
                      version.

                      I'm a longtime user of psgml-emacs.  Here's a list of some of the
                      features of psgml that I missed while building documents with
                      nxml.  They're listed under the psgml key bindings just for
                      reference, but the specific key bindings don't matter to me.


                      C-c Enter
                      ---------

                      Split the element containing the cursor.  I use this a lot to
                      start a new paragraph, turning this text (^^^=cursor)

                          <para>
                             Text text text...^^^
                          </para>

                      into this text:

                          <para>
                             Text text text...
                          </para>
                          <para>
                             ^^^
                          </para>


                      C-c C-d
                      -------

                      Move the cursor to the next place where text can go.  Example,
                      before:

                          <userinput><replaceable>x^^^</replaceable></userinput>

                      After using once:

                          <userinput><replaceable>x</replaceable>^^^</userinput>

                      After using twice:

                          <userinput><replaceable>x</replaceable></userinput>^^^


                      M-C-a
                      -----

                      Jump the cursor to the beginning of the current element.  Example
                      before:

                          <para>
                            Blah blah...
                            ...blah ^^^ blah...
                            ...blah blah.
                          </para>

                      After:

                          <para>^^^
                            Blah blah...
                            ...blah blah...
                            ...blah blah.
                          </para>


                      M-C-e
                      -----

                      Jump the cursor to the end of the current element.  Same example
                      as above, after:

                          <para>
                            Blah blah...
                            ...blah ^^^ blah...
                            ...blah blah.
                          </para>

                      After:

                          <para>^^^
                            Blah blah...
                            ...blah blah...
                            ...blah blah.
                          ^^^</para>


                      M-C-u
                      -----

                      Jump the cursor before the beginning of the current element.
                      Very useful in jumping from deeply nested tags (like the
                      middle of a <table>) to higher containing elements (like the
                      beginning of a <section>).


                      C-c -
                      -----

                      Remove the element containing the cursor, leaving the content.
                      Before:

                          <emphasis>Blah ^^^ blah</emphasis>

                      After:

                          Blah ^^^ blah

                      This is great for situations where I tag something with the wrong
                      element type.


                      C-c C-r
                      -------

                      Wrap the region with an element.  Prompts in the minibuffer for
                      the element name, with completion, then puts an opening tag
                      just before the region and a closing tag just after the region.


                      C-c C-a
                      -------

                      Splits the screen and shows, in the other window, all possible
                      attributes of the element containing the cursor.  This is more of
                      a luxury feature than the ones mentioned above, but it's very
                      handy to see not only the valid attribute names (which nxml will
                      give me in response to the completion command) but, in the case
                      of enumerated attributes, the possible values.


                      Features I'd like to see
                      ------------------------

                      How do I customize colors?


                      Documentation missing
                      ---------------------

                      I'm using the nxml-mode.info file to find out how to use this
                      package, but the article on this Web page mentions some features
                      that are not discussed in the info file:

                          http://www.xmlhack.com/read.php?item=2061

                      In particular, I couldn't find a mention of the C-c C-n command
                      to jump to the next invalid point, or C-M-\ (indent-region).


                      ================================================================

                      Thanks again for a great package.  I will be using it in production
                      from now on, even if no additional features are added.  But the
                      features above would make my work go a lot faster.

                      Best regards,
                      John Shipman (john@...), Applications Specialist, NM Tech Computer Center,
                      Speare 128, Socorro, NM 87801, (505) 835-5950, http://www.nmt.edu/~john
                        ``Let's go outside and commiserate with nature.''  --Dave Farber


                    Your message has been successfully submitted and would be delivered to recipients shortly.