Type: M-h C-u M-Enter.
Emacs inserts opening and closing paragraph tags.
8.3.2.5 Using completion
HTML helper mode supports completion. You type the beginning of a tag and press M-Tab (for tempo-complete-tag).[49] If there's more than one possibility, a window of possible completions appears. Let's say you are working on a bulleted list.
Type: <olM-Tab
Emacs inserts the tags to begin and end the list and the tag for one list item.
Note, however, that completion is sometimes case-sensitive. For example, typing <s M-Tab shows the following completions:
<select <span class=
<span style = <strike>
<strong> <samp>
Notice that the <script> tag is missing. But if you try typing <S M-Tab, the script tag and its attributes are inserted, as in:
<SCRIPT TYPE="text/javascript">
</SCRIPT>
The distinction between upper- and lowercase shows that HTML helper mode is moving toward XHTML compliance, but hasn't quite arrived. XHTML requires that all tags be lowercase. On the positive side, note that the attribute is in quotation marks, another XHTML requirement.
8.3.2.6 Turning on prompting
Some HTML tags require you to input certain attributes. For example, when you enter a hyperlink, you have to specify the URL of the link and the text that the user will select. If you type C-c C-a l (the lowercase letter "L") to enter a link, HTML helper mode inserts:
<a href=""></a>
with the cursor on the second quotation mark so you can type in the URL. HTML helper mode offers additional help if you turn on prompting. Add this line to your .emacs file:
(setq tempo-interactive t)
Note that HTML helper mode prompts only for required attributes; if you want to input optional attributes, you have to add them by hand.
Whether you consider prompting useful or intrusive is a matter of personal taste. If you are a beginning HTML author, prompting may help you remember to enter all the necessary information for each tag. If you find you don't like it, simply delete the line you added to the .emacs file.
8.3.2.7 Character encoding in HTML helper mode
HTML helper mode supports entry of only the most common character entities. However, it does make it easy to insert these entities. Simply type C-c before the character in question. For example, type C-c < to enter the escape code for a less-than sign (<).
Character entities are also available by selecting HTML → Insert Character Entities.
Table 8-5 lists bindings for inserting character entities in HTML helper mode.
Table 8-5. Inserting character entities in HTML helper mode
| Keystrokes | Command name | Character entity | Character rendered on web page |
|---|---|---|---|
| C-c > | tempo-template-html-greater-than | > |
> |
| C-c < | tempo-template-html-less-than | < |
< |
| C-c & | tempo-template-html-ampersand | & |
& |
| C-c u | tempo-template-html-u`-(&ù) | ù |
ù |
| C-c i | tempo-template-html-i`-(&ì) | ì |
ì |
| C-c o | tempo-template-html-o`-(&ò) | ò |
ò |
| C-c E | tempo-template-html-e'-(&é) | é |
é |
| C-c e | tempo-template-html-e`-(&è) | è |
è |
| C-c a | tempo-template-html-a`-(&à) | à |
à |
| C-c SPC | tempo-template-html-nonbreaking-space | |
nonbreaking space |
| C-c - | tempo-template-html-soft-hyphen | ­ |
soft hyphen |
| C-c @ | tempo-template-html-copyright | © |
© |
| C-c $ | tempo-template-html-registered | ® |
® |
| C-c " | tempo-template-html-quotation-mark " | " |
" |
| C-c # | tempo-template-html-ascii-code | Enter the 3-digit code for the desired character | specified character |
49
If M-Tab is trapped by the operating system to switch between applications (it is on Red Hat Linux), type Esc Tab instead.