wp.jochen.hayek.name/blog-en

nXML mode : use describe-mode within emacs

That’s the nicest and briefest description, that I know.
What a pity, that I haven’t been able to find it online so far.

But here it is:

nXML mode:
Major mode for editing XML.

Syntax highlighting is performed unless the variable `nxml-syntax-highlight-flag‘ is nil.

C-c C-f finishes the current element by inserting an end-tag.
C-c C-i closes a start-tag with `>’ and then inserts a balancing end-tag leaving point between the start-tag and end-tag.
C-c C-b is similar but for block rather than inline elements: the start-tag, point, and end-tag are all left on separate lines.
If `nxml-slash-auto-complete-flag‘ is non-nil, then inserting a `<!–' automatically inserts the rest of the end-tag.

<C-return> performs completion on the symbol preceding point.

C-c C-d uses the contents of the current buffer to choose a tag to put around the word preceding point.

Sections of the document can be displayed in outline form.  The variable `nxml-section-element-name-regexp‘ controls when an element is recognized as a section.  The same key sequences that change visibility in outline mode are used except that they start with C-c C-o instead of C-c.

Validation is provided by the related minor-mode `rng-validate-mode‘. This also makes completion schema- and context- sensitive.  Element names, attribute names, attribute values and namespace URIs can all be
completed. By default, `rng-validate-mode‘ is automatically enabled by `rng-nxml-mode-init‘ which is normally added to `nxml-mode-hook‘. You can toggle it using C-c C-v.

TAB indents the current line appropriately. This can be customized using the variable `nxml-child-indent‘ and the variable `nxml-attribute-indent‘.

C-c C-u inserts a character reference using the character’s name (by default, the Unicode name). C-u C-c C-u inserts the character directly.

The Emacs commands that normally operate on balanced expressions will operate on XML markup items.  Thus C-M-f will move forward across one markup item; C-M-b will move backward across one markup item; C-M-k will kill the following markup item; C-M-@ will mark the following markup item.  By default, each tag each treated as a single markup item; to make the complete element be treated as a single markup item, set the variable `nxml-sexp-element-flag‘ to t.  For more details, see the function `nxml-forward-balanced-item‘.

C-M-u and C-M-d move up and down the element structure.

Many aspects this mode can be customized using M-x customize-group nxml RET.

Exit mobile version