The Crash Course to DocBook

Appendix B. Emacs PSGML mode tips

There are a few SGML editors. A well known one is emacs with PSGML mode. It has emacs-style completion *on tags*.

Here are a few tips on how to use this mode. First install the "psgml" package, then load a DocBook file into Emacs.

Note

Emacs with PSGML mode does not support filenames ending in .docbook. Your file name has to end in .sgml or .xml like myfile.sgml.

If you type "C-c C-e" it will prompt you for an element, and offer as completions only the valid elements at that point.

Once it inserts the element, it inserts it with any required following elements along with a comment saying which ones you could put later on.

As an example, I just went to a DocBook buffer and typed



C-c C-e variab<SPACE BAR><RETURN>


and it inserted this text in the buffer:



    <variablelist>
      <varlistentry>
        <term></term>
        <listitem>
          <!-- one of (epigraph authorblurb abstract highlights comment bridgehead anchor sidebar procedure msgset table figure example equation informaltable informalexample informalequation graphicco graphic blockquote address simpara para formalpara funcsynopsis cmdsynopsis synopsis screenshot screenco screen programlistingco programlisting literallayout warning tip note important caution variablelist simplelist segmentedlist orderedlist itemizedlist glosslist calloutlist) -->
        </listitem>
      </varlistentry>
    </variablelist>

Another example:



C-c C-e i<SPACE BAR>


and it shows me the following completions:




Click mouse-2 on a completion to select it.
In this buffer, type RET to select the completion near point.

Possible completions are:
important                          indexterm
informalequation                   informalexample
informaltable                      itemizedlist