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

psgml commands sorely missed in nxml

Expand Messages
  • Steinar Bang
    Here s a list I ve compiled of the commands I m missing when trying to use nxml with my psgml-trained fingers: C-M-e (move to the end of the element, moves
    Message 1 of 15 , Dec 18, 2006
      Here's a list I've compiled of the commands I'm missing when trying to
      use nxml with my psgml-trained fingers:

      C-M-e (move to the end of the element, moves to the end of the file
      in nxml)

      C-M-k kill element

      C-c C-d (skip to the next text node, very efficient when working with
      mixed content)

      C-c C-+ (add attribute, incidentally I learnt about this command on
      this mailing list, with James saying that this mapping broke
      emacs' rules for mode specific mappings)

      C-c C-e (add element, based on context, adds both start and endtag
      and positions the cursor inside the element. `< C-RET' just
      doesn't feel the same. This is probably the command I used
      most in psgml)

      C-C C-a (add the attributes of the current element in a form-like
      fashion)

      Also, there are two commands that are present, but where I like the
      psgml keybindings better:
      C-M-f forward element (is C-M-n in nxml)
      C-M-b backward element (is C-M-p in nxml)
    • Dave Pawson
      ... Yes, that list came out earlier on :-) I think some people have added some features. You may not get them all. Any good with elisp? That should provide the
      Message 2 of 15 , Dec 18, 2006
        On 18/12/06, Steinar Bang <sb@...> wrote:
        > Here's a list I've compiled of the commands I'm missing when trying to
        > use nxml with my psgml-trained fingers:

        Yes, that list came out earlier on :-)
        I think some people have added some features.
        You may not get them all.

        Any good with elisp?
        That should provide the judgement of how much you need them :-)

        regards


        --
        Dave Pawson
        XSLT XSL-FO FAQ.
        http://www.dpawson.co.uk
      • Steinar Bang
        ... From me? Not this exact list, which is compiled after actually _using_ nxml. But I ve used the expression psgml-trained fingers before, that s true.
        Message 3 of 15 , Dec 19, 2006
          >>>>> "Dave Pawson" <dave.pawson@...>:

          > On 18/12/06, Steinar Bang <sb@...> wrote:
          >> Here's a list I've compiled of the commands I'm missing when trying to
          >> use nxml with my psgml-trained fingers:

          > Yes, that list came out earlier on :-)

          From me? Not this exact list, which is compiled after actually
          _using_ nxml. But I've used the expression "psgml-trained" fingers
          before, that's true.

          > I think some people have added some features.
          > You may not get them all.

          > Any good with elisp?
          > That should provide the judgement of how much you need them :-)

          We'll see what happens over the X-mas holidays.
        • Steinar Bang
          ... Not really, as it turns out. ... A small step on the way: - psgml keybindings for moving back and forward one element in the document structure - a
          Message 4 of 15 , Dec 19, 2006
            >>>>> Steinar Bang <sb@...>:

            >>>>> "Dave Pawson" <dave.pawson@...>:

            >> Any good with elisp?

            Not really, as it turns out.

            >> That should provide the judgement of how much you need them :-)

            > We'll see what happens over the X-mas holidays.

            A small step on the way:
            - psgml keybindings for moving back and forward one element in the
            document structure
            - a function (a hack really), and keybinding for moving to the start
            of the current element's content (psgml C-M-a)
            - a keybinding for moving to the end of the current element's
            content, ie psgml C-M-e (I may not have picked the right function
            here. I don't know how well it performs on mixed content)

            I've tried to create a method for killing the next element by setting
            nxml-sexp-element to t in a let, to get the sexp to be a balanced pair
            of tags, and then calling kill-sexp. But that still kills just the
            single tag.

            I have basically no idea how to create a function for moving to the
            next text content.

            I haven't looked into creating new element, and edit attribute
            functions.

            To get what I already have, follow the instructions below.

            Add the following to the ~/.emacs file:
            ;; add PSGML compatibility
            (require 'nxml-psgml-compatibility)
            (add-hook 'nxml-mode-hook 'nxml-add-psgml-compatibility)

            Put the nxml-psgml-compatibility.el file below somewhere in
            load-path.

            Restart emacs.

            ;; nxml-psgml-compatibility.el

            (defun nxml-add-psgml-compatibility ()
            "Add sorely missed functions to nxml."
            (define-key nxml-mode-map "\C-\M-b" 'nxml-backward-element)
            (define-key nxml-mode-map "\C-\M-f" 'nxml-forward-element)
            (define-key nxml-mode-map "\C-\M-a" 'nxml-move-to-start-of-element)
            (define-key nxml-mode-map "\C-\M-e" 'nxml-forward-balanced-item)
            )

            (defun nxml-move-to-start-of-element ()
            "Moves to just after the start tag.
            This is is cheating since it just uses existing functions
            to move up and down again, instead of properly navigating
            in the document."
            (interactive)
            (nxml-backward-up-element)
            (nxml-down-element))

            (provide 'nxml-psgml-compatibility)
          • Steinar Bang
            ... [snip!] ... [snip!] ... Actually, in mixed content nxml-forward-balanced-item behaves similar to psgml s sgml-next-data-field. The difference is that
            Message 5 of 15 , Dec 20, 2006
              >>>>> Steinar Bang <sb@...>:

              [snip!]
              > - a keybinding for moving to the end of the current element's
              > content, ie psgml C-M-e (I may not have picked the right function
              > here. I don't know how well it performs on mixed content)

              [snip!]
              > I have basically no idea how to create a function for moving to the
              > next text content.

              Actually, in mixed content nxml-forward-balanced-item behaves similar
              to psgml's sgml-next-data-field. The difference is that
              nxml-forward-balanced-item will always skip to the end of a text field
              before skipping to the next field.

              Hm...
            • Steinar Bang
              ... New version. Current state: - adds psgml compatible key bindings for backward and forward element - adds functions with psgml compatible keybindings for
              Message 6 of 15 , Dec 26, 2006
                >>>>> Steinar Bang <sb@...>:

                > To get what I already have, follow the instructions below.

                > Add the following to the ~/.emacs file:
                > ;; add PSGML compatibility
                > (require 'nxml-psgml-compatibility)
                > (add-hook 'nxml-mode-hook 'nxml-add-psgml-compatibility)

                > Put the nxml-psgml-compatibility.el file below somewhere in
                > load-path.

                > Restart emacs.

                New version. Current state:
                - adds psgml compatible key bindings for backward and forward element
                - adds functions with psgml compatible keybindings for moving to the
                start and end of elements
                - adds kill-element function with psgml compatible keybinding

                File follows:

                ;; nxml-psgml-compatibility.el

                (defun nxml-add-psgml-compatibility ()
                "Add sorely missed functions to nxml."
                (define-key nxml-mode-map "\C-\M-b" 'nxml-backward-element)
                (define-key nxml-mode-map "\C-\M-f" 'nxml-forward-element)
                (define-key nxml-mode-map "\C-\M-a" 'nxml-move-to-start-of-element)
                (define-key nxml-mode-map "\C-\M-e" 'nxml-move-to-end-of-element)
                (define-key nxml-mode-map "\C-\M-k" 'nxml-kill-element)
                )

                (defun nxml-move-to-start-of-element ()
                "Move the cursor to just after the start tag.
                This is is cheating since it just uses existing functions
                to move up and down again, instead of properly navigating
                in the document."
                (interactive)
                (nxml-backward-up-element)
                (nxml-down-element))

                (defun nxml-move-to-end-of-element ()
                "Move the cursor to just before the end tag."
                (interactive)
                (nxml-up-element)
                (nxml-down-element -1))

                (defun nxml-kill-element ()
                "Kill the next element"
                (interactive)
                (let ((nxml-sexp-element-flag t))
                (kill-sexp)))

                (provide 'nxml-psgml-compatibility)
              • Steinar Bang
                ... New version. Current state: - adds psgml compatible key bindings for backward and forward element - adds functions with psgml compatible keybindings for
                Message 7 of 15 , Dec 30, 2006
                  >>>>> Steinar Bang <sb@...>:

                  > To get what I already have, follow the instructions below.

                  > Add the following to the ~/.emacs file:
                  > ;; add PSGML compatibility
                  > (require 'nxml-psgml-compatibility)
                  > (add-hook 'nxml-mode-hook 'nxml-add-psgml-compatibility)

                  > Put the nxml-psgml-compatibility.el file below somewhere in
                  > load-path.

                  > Restart emacs.

                  New version. Current state:
                  - adds psgml compatible key bindings for backward and forward element
                  - adds functions with psgml compatible keybindings for moving to the
                  start and end of elements
                  - adds kill-element function with psgml compatible keybinding
                  - adds nxml-insert-element function, with psgml compatible
                  keybinding. This function prompts in the minibuffer for an element
                  to insert at point, and inserts a balanced start and end tag pair.
                  As inline if the element has mixed content, as block if it doesn't

                  File follows:

                  ;; nxml-psgml-compatibility.el

                  (defun nxml-add-psgml-compatibility ()
                  "Add sorely missed functions to nxml."
                  (define-key nxml-mode-map "\C-\M-b" 'nxml-backward-element)
                  (define-key nxml-mode-map "\C-\M-f" 'nxml-forward-element)
                  (define-key nxml-mode-map "\C-\M-a" 'nxml-move-to-start-of-element)
                  (define-key nxml-mode-map "\C-\M-e" 'nxml-move-to-end-of-element)
                  (define-key nxml-mode-map "\C-\M-k" 'nxml-kill-element)
                  (define-key nxml-mode-map "\C-c\C-e" 'nxml-insert-element)
                  )

                  (defun nxml-move-to-start-of-element ()
                  "Move the cursor to just after the start tag.
                  This is is cheating since it just uses existing functions
                  to move up and down again, instead of properly navigating
                  in the document."
                  (interactive)
                  (nxml-backward-up-element)
                  (nxml-down-element))

                  (defun nxml-move-to-end-of-element ()
                  "Move the cursor to just before the end tag."
                  (interactive)
                  (nxml-up-element)
                  (nxml-down-element -1))

                  (defun nxml-kill-element ()
                  "Kill the next element"
                  (interactive)
                  (let ((nxml-sexp-element-flag t))
                  (kill-sexp)))

                  (defun nxml-insert-element ()
                  "Reads element name from minibuffer and inserts start and end tags."
                  (interactive)
                  (insert "<")
                  (rng-complete)
                  ; This is a bit ugly. It would have felt better to pick
                  ; nxml-balanced-close-start-tag-inline for mixed content
                  ; and nxml-balanced-close-start-tag-block for element only
                  ; content. But rng-in-mixed-content-p always return t if
                  ; the end tag isn't present. And I have now idea for how
                  ; to find the tag name, and query the schema if that element
                  ; has mixed content or not (which is what feels natural
                  ; to do).
                  ; So what I do is to create the end tag, and then if point
                  ; isn't in mixed content insert two newlines with indent,
                  ; and position the cursor on a line in the middle of the
                  ; tags.
                  (nxml-balanced-close-start-tag-inline)
                  (if (not (rng-in-mixed-content-p))
                  (progn
                  (newline-and-indent)
                  (nxml-move-to-start-of-element)
                  (newline-and-indent)))
                  )

                  (provide 'nxml-psgml-compatibility)
                • Lennart Borgman
                  ... A nice way to add keybindings is to use define-minor-mode. Then you also will not need to add something to the hook. ... Why not start the names with
                  Message 8 of 15 , Dec 30, 2006
                    Steinar Bang wrote:
                    >>>>>> Steinar Bang <sb@...>:
                    >
                    >> To get what I already have, follow the instructions below.
                    >
                    >> Add the following to the ~/.emacs file:
                    >> ;; add PSGML compatibility
                    >> (require 'nxml-psgml-compatibility)
                    >> (add-hook 'nxml-mode-hook 'nxml-add-psgml-compatibility)
                    >
                    >> Put the nxml-psgml-compatibility.el file below somewhere in
                    >> load-path.
                    >
                    >> Restart emacs.
                    >
                    > New version. Current state:
                    > - adds psgml compatible key bindings for backward and forward element
                    > - adds functions with psgml compatible keybindings for moving to the
                    > start and end of elements
                    > - adds kill-element function with psgml compatible keybinding
                    > - adds nxml-insert-element function, with psgml compatible
                    > keybinding. This function prompts in the minibuffer for an element
                    > to insert at point, and inserts a balanced start and end tag pair.
                    > As inline if the element has mixed content, as block if it doesn't
                    >
                    > File follows:
                    >
                    > ;; nxml-psgml-compatibility.el
                    >
                    > (defun nxml-add-psgml-compatibility ()
                    > "Add sorely missed functions to nxml."
                    > (define-key nxml-mode-map "\C-\M-b" 'nxml-backward-element)
                    > (define-key nxml-mode-map "\C-\M-f" 'nxml-forward-element)
                    > (define-key nxml-mode-map "\C-\M-a" 'nxml-move-to-start-of-element)
                    > (define-key nxml-mode-map "\C-\M-e" 'nxml-move-to-end-of-element)
                    > (define-key nxml-mode-map "\C-\M-k" 'nxml-kill-element)
                    > (define-key nxml-mode-map "\C-c\C-e" 'nxml-insert-element)
                    > )


                    A nice way to add keybindings is to use define-minor-mode. Then you also
                    will not need to add something to the hook.


                    > (defun nxml-move-to-start-of-element ()

                    Why not start the names with nxmlpsgml- or something to avoid future
                    name clashes?

                    > (defun nxml-insert-element ()
                    > "Reads element name from minibuffer and inserts start and end tags."
                    > (interactive)
                    > (insert "<")
                    > (rng-complete)


                    I am not sure, but I do not think this will work as expected. If I
                    remember correctly then rng-complete assumes that nxml-complete has done
                    some things before that sets the state.

                    You can find code doing what you want in nxhtml-mode. But before getting
                    it from there it might be better to wait until I have cleaned up the
                    completion code a bit.
                  • Steinar Bang
                    ... Ok. I ll read up on that. ... Good idea. Will do. ... It seems to be working. But it is admittedly a hack...:-) I was unable to figure out what nxml api
                    Message 9 of 15 , Dec 30, 2006
                      >>>>> Lennart Borgman <lennart.borgman.073@...>:

                      > A nice way to add keybindings is to use define-minor-mode. Then you
                      > also will not need to add something to the hook.

                      Ok. I'll read up on that.


                      >> (defun nxml-move-to-start-of-element ()

                      > Why not start the names with nxmlpsgml- or something to avoid future
                      > name clashes?

                      Good idea. Will do.

                      >> (defun nxml-insert-element ()
                      >> "Reads element name from minibuffer and inserts start and end tags."
                      >> (interactive)
                      >> (insert "<")
                      >> (rng-complete)


                      > I am not sure, but I do not think this will work as expected. If I
                      > remember correctly then rng-complete assumes that nxml-complete has
                      > done some things before that sets the state.

                      It seems to be working. But it is admittedly a hack...:-)

                      I was unable to figure out what nxml api functions to do what I want,
                      so I sort of canned what I was doing with the existing commands to get
                      what I want.

                      > You can find code doing what you want in nxhtml-mode.

                      Indeed, I was just going to post a question about that. The screen
                      shot here
                      http://ourcomments.org/Emacs/DL/EmacsW32-only/src/EmacsW32/nxml/nxhtml/doc/nxhtml.html
                      seems very similar to what psgml does when the insert element command
                      is invoked from the menus.

                      > But before getting it from there it might be better to wait until I
                      > have cleaned up the completion code a bit.

                      Ok.
                    • Carsten Bormann
                      ... Oh, and C-c = (sgml-change-element-name, to change element type of the current element). Not to forget C-c C-r (sgml-tag-region). Sorely missed, indeed.
                      Message 10 of 15 , Dec 30, 2006
                        On Dec 18 2006, at 14:15, Steinar Bang wrote:

                        > C-c C-e (add element, based on context, adds both start and endtag
                        > and positions the cursor inside the element. `< C-RET' just
                        > doesn't feel the same. This is probably the command I used
                        > most in psgml)

                        Oh, and C-c = (sgml-change-element-name, to change element type of
                        the current element).
                        Not to forget C-c C-r (sgml-tag-region).
                        Sorely missed, indeed.

                        Gruesse, Carsten
                      • Steinar Bang
                        ... BTW, how do I add this minor mode to nxml-mode other than using nxml-mode-hook? Right now I ve added a minor mode, using define-minor-mode, and have
                        Message 11 of 15 , Dec 30, 2006
                          >>>>> Lennart Borgman <lennart.borgman.073@...>:

                          >> A nice way to add keybindings is to use define-minor-mode. Then you
                          >> also will not need to add something to the hook.

                          BTW, how do I add this minor mode to nxml-mode other than using
                          nxml-mode-hook?

                          Right now I've added a minor mode, using define-minor-mode, and have
                          changed nxml-add-psgml-compatibility to look like this:

                          (defun nxml-add-psgml-compatibility ()
                          "Function to be added to nxml-mode-hook to add psgml
                          the psgml compatibility minor mode."
                          (nxml-psgml-compatibility-mode 1))

                          It seems to work.

                          Is there a different way?

                          Thanx!
                        • Steinar Bang
                          ... New version (the holidays are over, so it ll probably be the final version for a wile...:-) ). Current state: - uses the prefix nxmlpsgml- for all
                          Message 12 of 15 , Jan 1, 2007
                            >>>>> Steinar Bang <sb@...>:

                            > To get what I already have, follow the instructions below.

                            > Add the following to the ~/.emacs file:
                            > ;; add PSGML compatibility
                            > (require 'nxml-psgml-compatibility)
                            > (add-hook 'nxml-mode-hook 'nxml-add-psgml-compatibility)

                            > Put the nxml-psgml-compatibility.el file below somewhere in
                            > load-path.

                            > Restart emacs.

                            New version (the holidays are over, so it'll probably be the final
                            version for a wile...:-) ).

                            Current state:
                            - uses the prefix nxmlpsgml- for all functions to avoid conflict with
                            nxml (or anything else for that matter)
                            - uses a minor mode to add the psgml compatibility keybindings to
                            nxml (perhaps not done quite right yet? It still requires adding a
                            function to nxml-mode-hook)
                            - adds psgml compatible key bindings for backward and forward element
                            - adds functions with psgml compatible keybindings for moving to the
                            start and end of elements
                            - adds kill-element function with psgml compatible keybinding
                            - adds nxml-insert-element function, with psgml compatible
                            keybinding. This function prompts in the minibuffer for an element
                            to insert at point, and inserts a balanced start and end tag pair.
                            As inline if the element has mixed content, as block if it doesn't

                            File follows:

                            ;; nxml-psgml-compatibility.el

                            (define-minor-mode nxml-psgml-compatibility-mode
                            "Add familiar psgml commands to nxml-mode."
                            ;; The initial value
                            nil
                            ;; The indicator for the mode line.
                            " psgml-compat"
                            ;; The minor mode bindings
                            '(("\C-\M-b" . nxml-backward-element)
                            ("\C-\M-f" . nxml-forward-element)
                            ("\C-\M-a" . nxmlpsgml-move-to-start-of-element)
                            ("\C-\M-e" . nxmlpsgml-move-to-end-of-element)
                            ("\C-\M-k" . nxmlpsgml-kill-element)
                            ("\C-c\C-e" . nxmlpsgml-insert-element)))

                            (defun nxml-add-psgml-compatibility ()
                            "Function to be added to nxml-mode-hook to add psgml
                            the psgml compatibility minor mode."
                            (nxml-psgml-compatibility-mode 1))

                            (defun nxmlpsgml-move-to-start-of-element ()
                            "Move the cursor to just after the start tag.
                            This is is cheating since it just uses existing functions
                            to move up and down again, instead of properly navigating
                            in the document."
                            (interactive)
                            (nxml-backward-up-element)
                            (nxml-down-element))

                            (defun nxmlpsgml-move-to-end-of-element ()
                            "Move the cursor to just before the end tag."
                            (interactive)
                            (nxml-up-element)
                            (nxml-down-element -1))

                            (defun nxmlpsgml-kill-element ()
                            "Kill the next element"
                            (interactive)
                            (let ((nxml-sexp-element-flag t))
                            (kill-sexp)))

                            (defun nxmlpsgml-insert-element ()
                            "Reads element name from minibuffer and inserts start and end tags."
                            (interactive)
                            (insert "<")
                            (rng-complete)
                            ; This is a bit ugly. It would have felt better to pick
                            ; nxml-balanced-close-start-tag-inline for mixed content
                            ; and nxml-balanced-close-start-tag-block for element only
                            ; content. But rng-in-mixed-content-p always return t if
                            ; the end tag isn't present. And I have now idea for how
                            ; to find the tag name, and query the schema if that element
                            ; has mixed content or not (which is what feels natural
                            ; to do).
                            ; So what I do is to create the end tag, and then if point
                            ; isn't in mixed content insert two newlines with indent,
                            ; and position the cursor on a line in the middle of the
                            ; tags.
                            (nxml-balanced-close-start-tag-inline)
                            (if (not (rng-in-mixed-content-p))
                            (progn
                            (newline-and-indent)
                            (nxmlpsgml-move-to-start-of-element)
                            (newline-and-indent)))
                            )

                            (provide 'nxml-psgml-compatibility)
                          • Lennart Borgman
                            ... Don t you get hit by the message `
                            Message 13 of 15 , Jan 2, 2007
                              Steinar Bang wrote:

                              > (defun nxmlpsgml-insert-element ()
                              > "Reads element name from minibuffer and inserts start and end tags."
                              > (interactive)
                              > (insert "<")

                              Don't you get hit by the message

                              `<' that is not markup must be entered as `<'

                              I use

                              (while (rng-do-some-validation) nil)
                              (rng-validate-done)

                              before rng-complete to get rid of it.

                              > (rng-complete)

                              > ; the end tag isn't present. And I have now idea for how
                              > ; to find the tag name, and query the schema if that element
                              > ; has mixed content or not (which is what feels natural
                              > ; to do).


                              Neither have I. Does someone know?
                            • Steinar Bang
                              ... Indeed I do. ... Thank you! I thought I was going to have to live with it...:-)
                              Message 14 of 15 , Jan 2, 2007
                                >>>>> Lennart Borgman <lennart.borgman.073@...>:

                                > Don't you get hit by the message

                                > `<' that is not markup must be entered as `<'

                                Indeed I do.

                                > I use

                                > (while (rng-do-some-validation) nil)
                                > (rng-validate-done)

                                > before rng-complete to get rid of it.

                                Thank you! I thought I was going to have to live with it...:-)
                              • Steinar Bang
                                ... New version. Current state: - avoids annoying minibuffer error message before prompting for name of element to insert - uses the prefix nxmlpsgml- for
                                Message 15 of 15 , Jan 2, 2007
                                  >>>>> Steinar Bang <sb@...>:

                                  > To get what I already have, follow the instructions below.

                                  > Add the following to the ~/.emacs file:
                                  > ;; add PSGML compatibility
                                  > (require 'nxml-psgml-compatibility)
                                  > (add-hook 'nxml-mode-hook 'nxml-add-psgml-compatibility)

                                  > Put the nxml-psgml-compatibility.el file below somewhere in
                                  > load-path.

                                  > Restart emacs.

                                  New version. Current state:
                                  - avoids annoying minibuffer error message before prompting for name
                                  of element to insert
                                  - uses the prefix nxmlpsgml- for all functions to avoid conflict with
                                  nxml (or anything else for that matter)
                                  - uses a minor mode to add the psgml compatibility keybindings to
                                  nxml (perhaps not done quite right yet? It still requires adding a
                                  function to nxml-mode-hook)
                                  - adds psgml compatible key bindings for backward and forward element
                                  - adds functions with psgml compatible keybindings for moving to the
                                  start and end of elements
                                  - adds kill-element function with psgml compatible keybinding
                                  - adds nxml-insert-element function, with psgml compatible
                                  keybinding. This function prompts in the minibuffer for an element
                                  to insert at point, and inserts a balanced start and end tag pair.
                                  As inline if the element has mixed content, as block if it doesn't

                                  File follows:

                                  ;; nxml-psgml-compatibility.el

                                  (define-minor-mode nxml-psgml-compatibility-mode
                                  "Add familiar psgml commands to nxml-mode."
                                  ;; The initial value
                                  nil
                                  ;; The indicator for the mode line.
                                  " psgml-compat"
                                  ;; The minor mode bindings
                                  '(("\C-\M-b" . nxml-backward-element)
                                  ("\C-\M-f" . nxml-forward-element)
                                  ("\C-\M-a" . nxmlpsgml-move-to-start-of-element)
                                  ("\C-\M-e" . nxmlpsgml-move-to-end-of-element)
                                  ("\C-\M-k" . nxmlpsgml-kill-element)
                                  ("\C-c\C-e" . nxmlpsgml-insert-element)))

                                  (defun nxml-add-psgml-compatibility ()
                                  "Function to be added to nxml-mode-hook to add psgml
                                  the psgml compatibility minor mode."
                                  (nxml-psgml-compatibility-mode 1))

                                  (defun nxmlpsgml-move-to-start-of-element ()
                                  "Move the cursor to just after the start tag.
                                  This is is cheating since it just uses existing functions
                                  to move up and down again, instead of properly navigating
                                  in the document."
                                  (interactive)
                                  (nxml-backward-up-element)
                                  (nxml-down-element))

                                  (defun nxmlpsgml-move-to-end-of-element ()
                                  "Move the cursor to just before the end tag."
                                  (interactive)
                                  (nxml-up-element)
                                  (nxml-down-element -1))

                                  (defun nxmlpsgml-kill-element ()
                                  "Kill the next element"
                                  (interactive)
                                  (let ((nxml-sexp-element-flag t))
                                  (kill-sexp)))

                                  (defun nxmlpsgml-insert-element ()
                                  "Reads element name from minibuffer and inserts start and end tags."
                                  (interactive)
                                  (insert "<")
                                  (while (rng-do-some-validation) nil)
                                  (rng-validate-done)
                                  (rng-complete)
                                  ; This is a bit ugly. It would have felt better to pick
                                  ; nxml-balanced-close-start-tag-inline for mixed content
                                  ; and nxml-balanced-close-start-tag-block for element only
                                  ; content. But rng-in-mixed-content-p always return t if
                                  ; the end tag isn't present. And I have no idea for how
                                  ; to find the tag name, and query the schema if that element
                                  ; has mixed content or not (which is the approach that feels
                                  ; natural to do).
                                  ; So what I do is to create the end tag, and then if point
                                  ; isn't in mixed content insert two newlines with indent,
                                  ; and position the cursor on a line in the middle of the
                                  ; tags.
                                  (nxml-balanced-close-start-tag-inline)
                                  (if (not (rng-in-mixed-content-p))
                                  (progn
                                  (newline-and-indent)
                                  (nxmlpsgml-move-to-start-of-element)
                                  (newline-and-indent)))
                                  )

                                  (provide 'nxml-psgml-compatibility)
                                Your message has been successfully submitted and would be delivered to recipients shortly.