Re: Automatic Insertion of Required Elements and Attributes

"John W. Shipman" <[email protected]>
Newsgroups gmane.emacs.nxml.general
Message-ID <[email protected]>
+--
| I'm actually slightly amazed. How do you deal with the absence of C-c
| C-e, C-c C-r, C-RET, M-C-k, and all the other editing functions? Is
| there a shim that implements these somewhere?
+--

I used to use sgml-mode but now I do everything in nxml-mode.  I
forget what all those keybindings meant, but I can address your
need for insertion of required child elements.  Back in 2007 one
Stefano Sabatini asked a similar question.  Here's my reply.

+-- Mr. Sabatini:
| And what about the insertion of complex skeletons, like that of a
| variablelist? There is already some way to add them with some
| shortcuts or is needed to hook into nxml-mode-hook all the various
| docbook specific skeleton insertion functions required?
+--

My solution to this is to put together a collection of little
template files and insert them using "C-x i".  For example,
if I'm building a variablelist, I have two template files named
"varlist" containing the variablelist element, and a file "vle"
containing the skeleton of a varlistentry element.  Here's the
"varlist" file:

================================================================
       <variablelist>
<!--\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\-->
       </variablelist>
----------------------------------------------------------------

The comment line is there to remind me to fill in the body.
As I add each child element, I keep that comment line just
below the element just added, so I can quickly find the
spot where the next child element will go in.  Once the
list is complete, I'll delete the comment line.

Here's my template file "vle" for a varlistentry:

================================================================
         <varlistentry>
           <term>
             <code >
</code >
           </term>
           <listitem>
             <para>

             </para>
           </listitem>
         </varlistentry>
----------------------------------------------------------------

This assumes that the terms I'm defining are in code.  I have the
</code> closing tag unindented because it's inline markup:  I'll
add the term's text after the <code> start tag, then use C-d to
pull the </code> end tag up just after it.

Not elegant, but I've been using it for a long time now, and
it speeds up document creation a lot.

There's a more detailed discussion in my locally-written nxml
documentation:

     http://www.nmt.edu/tcc/help/pubs/nxml/

Scroll down to the section entitled "Toward faster work".

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


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/emacs-nxml-mode/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/emacs-nxml-mode/join
    (Yahoo! ID required)

<*> To change settings via email:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.