Writing HTML

Without doubt, the most commonly used markup language today is hypertext markup language (HTML), used for creating web pages. HTML consists of text with tags that define characteristics about the text. HTML is not hard to write, and you could use Emacs or any other editor to write the tags and the text. An HTML tag generally looks like this:

<tagname>text being tagged</tagname>

For your convenience, several modes are available for writing HTML in Emacs, including HTML mode, HTML helper mode, html menus, and a variety of SGML[1] tools including sgml mode and psgml mode. Of these tools, we've chosen to describe HTML mode, a variant of sgml mode, which is included in GNU Emacs, and HTML helper mode, which is a popular add-on. If you are writing XHTML, a stricter version of HTML that can be validated, you should consider XHTML mode, described briefly in this section, or psgml mode, covered later in the XML section of this chapter.

Serious web developers may want to investigate some of the cutting edge development going on to make Emacs even more powerful. Check out HTMLModeDeluxe (http://www.emacswiki.org/cgi-bin/wiki/HtmlModeDeluxe) and the Emacs WebDev Environment by Darren Brierton (http://www.dzr-web.com/people/darren/projects/emacs-webdev). Both of these tools support mmm mode (where mmm stands for "multiple major modes"). Using this feature, the cursor changes major mode depending on the section of the page you are editing. When you edit a script, the mode changes automatically to support that type of authoring. Both are excellent tools for building complex web pages.

In the following sections, we are not going to teach you to write HTML. (For more information on writing HTML, see HTML and XHTML: The Definitive Guide by Chuck Musciano and Bill Kennedy, O'Reilly) Rather, we're going to teach you the rudiments of using HTML mode and HTML helper mode to help you create HTML documents.

To start HTML mode, type M-x html-mode (or simply open an HTML file). Most authors use a standard template when they write HTML. You may already have one. If you don't, HTML mode is happy to supply one for you. Simply start by typing C-c C-t (for sgml-tag) or by selecting Insert Tag from the SGML menu. If you enter the <html> tag that signifies the start of an HTML document, Emacs inserts a basic template in your buffer.

Note that Emacs automatically creates a first-level header that is equal to the title you entered. It also inserts a hyperlink so that readers can email you. Depending on your spam tolerance, you may want to delete that line. Also, Emacs is just guessing at your name and email address. You can set these explicitly by adding two lines to your .emacs file. Change Mr. Dickens' information to settings appropriate for you.

(setq user-mail-address "cdickens@great-beyond.com")
(setq user-full-name "Charles Dickens")

You could approach HTML mode in a couple of ways. You could learn the key bindings for various tags, or you could simply use the sgml-tag command for everything. It depends how many bindings you want to learn. A mixed approach may be best, where you learn keystrokes for the most common tags and use sgml-tag for less common tags.

Key bindings are intuitive in HTML mode. Like most specialized editing modes, many functions are bound to C-c C- something. We've seen C-c C-t to insert a tag. You won't be too surprised to find that to move forward to the next tag you type C-c C-f and to move back to the previous tag you type C-c C-b. To insert an <href> tag, type C-c C-h. You see what we mean.

HTML mode is designed for writing HTML, not XHTML. XHTML is stricter, requiring all tags to have a closing tag. The common <p> tag is a salient example. HTML authors would never use the closing tag </p> that XHTML requires. HTML mode inserts a lone <p> tag even when given a command, such as sgml-tag, that normally inserts a tag pair. If you want to write XHTML, use XHTML mode instead. Emacs starts this mode itself if your file contains a reference to an XHTML document type definition. Other than completion of tags, XHTML mode is very similar to HTML mode described here.[2]

Being able to hide the tags is a helpful feature. To hide HTML tags, type C-c Tab; use the same command to display the tags again. Let's say that we've inserted some of our dickens file into the dickens.html file we were just working with.

You can keep typing text, concentrating on what you're writing rather than being distracted by the markup. Emacs protects you from deleting tags when you're writing by making hidden text read-only. If you move the cursor onto a hidden tag, Emacs displays it in the minibuffer.

Of course, the whole purpose of writing HTML is to display it in a web browser. Typing C-c C-v (for browse-url-of-buffer) opens the default web browser to view the web page you're writing.

If you'd like to look at the file in a web browser each time you save, you can turn on a function called html-autoview-mode, invoked by pressing C-c C-s. When you save the file, Emacs automatically opens it in the default browser.

What if you want to include special characters or characters from other character sets in your web page? The short answer is that you can enter a character's encoding explicitly. For example, to enter a capital U with an umlaut, you can type &#220;. Many characters can also be represented as named entities, which are certainly easier to remember than numbers. For example, the named entity for a capital U with an umlaut is &Uuml;.

But HTML mode does provide more support than this. We'll take the simplest case first. Let's say you can create a character with your keyboard; for a common case, take the ampersand, a character that must be encoded since it has a special meaning in HTML. Type C-c C-n & Enter. Emacs inserts the entity for an ampersand, &amp;. You can insert entities for a wide variety of keyboard characters this way.

But let's say that you are inserting characters that are not on your keyboard. For example, perhaps you are in the U.S. writing up a list of contributors from Europe and many of their names have accent marks. The ISO Latin-1 character set will handle this.

If you have a keyboard that already emits Latin-1 characters and Latin-1 is your default coding system for keyboard input, inserting such characters is relatively straightforward. Simply press C-c 8 to turn on a minor mode called SGML name entity mode. Emacs says sgml name entity mode is now on.[3] C-c 8 toggles this state. Type Latin-1 characters as you normally would and Emacs inserts the named entities associated with those characters.

For those of us with other keyboard encodings, however, there's a bit more to do. To get bindings to insert entities into your HTML file, we discuss two options. The first is ISO accents mode. This mode provides support, as the name implies, for accented text. Whether you're typing umlauts, cedillas, circumflexes, acute, or grave marks, ISO accents mode is up to the task. The other option is to use the C-x 8 prefix to insert a wide range of entities, including currency signs, mathematical symbols, and copyright signs (as well as all the accented characters ISO accents mode supports).

You can also insert a wide range of entities using C-x 8 after you do some setup.[4] First enter SGML name entity mode by typing C-c 8. Next specify Latin-1 as your character set by typing C-x Enter k latin-1 Enter. You can then enter a large number of entities by typing commands prefixed with C-x 8. For example, to insert the entity for a yen symbol, type C-x 8 Y. Watch the minibuffer. The literal character will appear in the minibuffer as the entity is inserted. Both ISO accents mode and the C-x 8 prefixes allow you to type a single undo command (C-_) to translate the entity back into the literal character.

Table 8-2 provides a list of accented characters and the bindings that help insert them. Table 8-3 lists other named entities including punctuation marks and symbols.

Table 8-2. Bindings for inserting entities for accented characters[5]

C-x 8 prefix

keystrokes

ISO accents mode shortcut

Character entity

Character displayed in browser

C-x 8 "

"

&acute;

´

C-x 8 ' a

' a

&aacute;

á

C-x 8 'A

'A

&Aacute;

Á

                                    C-x 8 ' e
' e
&eacute;

é

                                    C-x 8 ' E
' E
&Eacute;

É

                                    C-x 8 ' i
' i
&iacute;

í

C-x 8 ' I

' I

&Iacute;

Í

                                    C-x 8 ' o
' o
&oacute;

ó

                                    C-x 8 ' O
' O
&Oacute;

Ó

                                    C-x 8 ' u
' u
&uacute;

ú

                                    C-x 8 ' U
' U
&Uacute;

Ú

                                    C-x 8 ' y
' y
&yacute;

Bindings for inserting entities for accented charactersFor instructions on making these bindings work properly, read this section carefully.

                                    C-x 8 ' Y
' Y
&Yacute;

Bindings for inserting entities for accented charactersFor instructions on making these bindings work properly, read this section carefully.

                                    C-x 8 ` a
                                    ` a
&agrave;

à

C-x 8 ` A

` A

&Agrave;

À

C-x 8 ` e

` e

&egrave;

è

C-x 8 ` E

` E

&Egrave;

È

C-x 8 ` i

` i

&igrave;

ì

C-x 8 ` I

` I

&Igrave;

Ì

C-x 8 ` o

` o

&ograve;

ò

C-x 8 ` O

` O

&Ograve;

Ò

C-x 8 ` u

` u

&ugrave;

ù

C-x 8 ` U

` U

&Ugrave;

Bindings for inserting entities for accented charactersFor instructions on making these bindings work properly, read this section carefully.

C-x 8 ^ a

^ a

&acirc;

â

C-x 8 ^ A

^ A

&Acirc;

Â

C-x 8 ^ e

^ e

&ecirc;

ê

C-x 8 ^ E

^ E

&Ecirc;

Ê

C-x 8 ^ i

^ i

&icirc;

î

C-x 8 ^ I

^ I

&Icirc;

Î

C-x 8 ^ o

^ o

&ocirc;

ô

C-x 8 ^ O

^ O

&Ocirc;

Ô

C-x 8 ^ u

^ u

&ucirc;

û

C-x 8 ^ U

^ U

&Ucirc;

Û

C-x 8 " "

" "

&uml;

¨

C-x 8 " a

" a

&auml;

ä

C-x 8 " A

" A

&Auml;

Ä

C-x 8 " e

" e

&euml;

ë

C-x 8 " E

" E

&Euml;

Ë

C-x 8 " i

" i

&iuml;

ï

C-x 8 " I

" I

&Iuml;

Ï

C-x 8 " o

" o

&ouml;

ö

C-x 8 " O

" O

&Ouml;

Ö

C-x 8 " u

" u

&uuml;

ü

C-x 8 " U

" U

&Uuml;

Ü

C-x 8 " s

" s

&szlig;

ß

C-x 8 " y

" y

&yuml;

ÿ

C-x 8 " Y

" Y

&Yuml;

Ÿ

C-x 8 ~ ~

&not;

¬

C-x 8 ~ a

~ a

&atilde;

ã

C-x 8 ~ A

~ A

&Atilde;

Ã

C-x 8 ~ d

~ d

&eth;

Bindings for inserting entities for accented charactersFor instructions on making these bindings work properly, read this section carefully.

C-x 8 ~ D

~ D

&ETH;

Bindings for inserting entities for accented charactersFor instructions on making these bindings work properly, read this section carefully.

C-x 8 ~ n

~ n

&ntilde;

ñ

C-x 8 ~ N

~ N

&Ntilde;

Ñ

C-x 8 ~ o

~ o

&otilde;

õ

C-x 8 ~ O

~ O

&Otilde;

Õ

C-x 8 ~ t

~ t

&thorn;

Bindings for inserting entities for accented charactersFor instructions on making these bindings work properly, read this section carefully.

C-x 8 ~ T

~ T

&THORN;

Bindings for inserting entities for accented charactersFor instructions on making these bindings work properly, read this section carefully.

C-x 8 / /

&divide;

÷

C-x 8 o

/ /

&ring;

°

C-x 8 / a

/ a

&aring;

å

C-x 8 / A

/ A

&Aring;

Å

C-x 8 / e

/ e

&aelig;

æ

C-x 8 / E

/ E

&AElig;

Æ

C-x 8 / o

/ o

&oslash;

ø

C-x 8 / O

/ O

&Oslash;

Ø

C-x 8 , ,

~~

&cedil;

¸

C-x 8 , c

~c

&ccedil;

ç

C-x 8 , C

~C

&Ccedil;

Ç

[5] For instructions on making these bindings work properly, read this section carefully.



Table 8-4 lists HTML mode commands.

Table 8-4. HTML mode commands

Keystrokes

Command name

Action

(none)

html-mode

Enter HTML mode.

C-c C-t SGML Insert Tag

sgml-tag

Inserts a tag, prompting for attributes. If you enter html as the tag name, inserts a template html file.

C-c Tab SGML Toggle Tag Visibility

sgml-tags-invisible

Hides or shows the tags in the file.

C-c C-v SGML View Buffer Contents

browse-url-of-buffer

Display buffer in default browser.

C-c C-s

html-autoview- mode

If this mode is on (this command toggles it), display file in browser each time it is saved in Emacs.

C-c 8

sgml-name-8bit-mode

If turned on, certain keystrokes for inserting Latin-1 characters are captured and replaced with the appropriate entities. See "Character encoding in HTML mode" for details.

C-c C-f SGML Forward Tag

sgml-skip-tag-forward

Move forward to the next tag of the same level.

C-c C-b SGML Backward Tag

sgml-skip-tag-backward

Move backward to previous tag of the same level.

C-c Del or C-c C-d SGML Delete Tag

sgml-delete-tag

With cursor on or before a tag, deletes tag or tag pair.

C-c 1

html-headline-1

Insert an <h1>.

C-c 2

html-headline-2

Insert an <h2>.

C-c 3

html-headline-3

Insert an <h3>.

C-c 4

html-headline-4

Insert an <h4>.

C-c 5

html-headline-5

Insert an <h5>.

C-c 6

html-headline-6

Insert an <h6> (useful for footnote text) .

C-c Enter

html-paragraph

Insert <p> tag.

C-c C-c h HTML Href Anchor

html-href-anchor

Insert a hyperlink.

C-c C-c n HTML Name Anchor

html-name-anchor

Insert an anchor so that a link can be created to the anchored part of the page.

C-c C-c u HTML Unordered List

html-unordered-list

Create a bulleted list.

C-c C-c o HTML Ordered List

html-ordered-list

Create a numbered list.

C-c C-c l HTML List Item

html-list-item

Add an item to a list.

C-c C-c i HTML Image

html-image

Insert <img src=""> and position cursor for you to enter filename of image.

C-c C-j HTML Line Break

html-line

Insert a line break (<br>).

C-c C-c - HTML Horizontal Rule

html-horizontal-rule

Insert a horizontal rule (<hr>).

C-c C-c r

html-radio-buttons

Insert a group of radio buttons. Emacs prompts for a name for the group, then repeatedly for value, whether it should be checked, and associated text. Press C-g to complete the group.

C-c C-c c HTML Checkboxes

html-checkboxes

Insert a group of checkboxes. Emacs prompts for a name for the group, then repeatedly for value, whether it should be checked, and associated text. Press C-g to complete the group.

C-c ? SGML Describe Tag

sgml-tag-help

Provide brief verbal description of tag at cursor position.


HTML helper mode, written by Nelson Minar and now maintained by Gian Uberto Lauri, offers great flexibility in writing HTML. You can enable various hand-holding features depending on your level of expertise and preferences.

Why would you choose HTML helper mode over Emacs's own HTML mode? Although HTML mode makes it easy to write basic HTML, it provides little support for programmatic, interactive web pages. HTML helper mode supports ASP, JSP (and JDE, the Java Development Environment, discussed in Chapter 9), and PHP, to name a few more advanced features. If you're writing HTML in Emacs, you're likely to be a developer of such pages rather than a more text-oriented author. For this reason, HTML helper mode continues to be popular among Emacs users.

Html helper mode is not part of Emacs by default. You can download it from its homepage at http://www.nongnu.org/baol-hth. Download the file into a directory such as ~/elisp, move to that directory, and then type:

% tar xvzf html-helper-mode.tar.gz

The system unpacks the tar file for you. (Of course, if you are installing on Windows, you can simply use WinZip to decompress and unpack the file.) The tar file contains several components, including:

Before you can start HTML helper mode, you have to load it into Emacs. (For a complete discussion of this topic, see "Building Your Own Lisp Library" in Chapter 11; we describe it briefly here.) Begin by typing M-x load-file Enter. Emacs asks which file to load and you enter ~/elisp/html-helper-mode.el and press Enter, adjusting the path to reflect the location where you installed html-helper-mode.el. You enter the mode by typing M-x html-helper-mode Enter. HTML helper appears on the mode line.

Making HTML helper mode part of your startup is easier. Put the following lines in your .emacs file:

(setq load-path (cons "~/elisp " load-path))
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)

In the first line, insert the complete path for the directory in which html-helper-mode.el is located in quotation marks, replacing ~/elisp to the correct value for your system. The second line tells Emacs to load HTML helper mode automatically when you start Emacs.

If you want to use HTML helper mode for editing HTML files by default, add this line to .emacs as well:

(setq auto-mode-alist (cons '("\\.html?$" . html-helper-mode) 
auto-mode-alist))

If you edit other types of files with HTML helper mode, you may want to add lines to include all the types of files you edit. Adding more lines is the easiest way. For example, to make HTML helper mode the default for PHP files, add this line to .emacs:

(setq auto-mode-alist (cons '("\\.php$" . html-helper-mode) 
auto-mode-alist))

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 (&lt;).

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-6 lists the key bindings for HTML helper mode. There are key bindings for advanced HTML features such as forms as well as for some of the HTML 3.0 features. Some tags would normally appear on different lines (for example, in the case of a list); in this table, they are shown on one line.

Table 8-6. HTML helper mode commands

Keystrokes

Command name

Action

C-u

universal-argument

When used before any other tag command, insert tags around a region.

M-Tab

tempo-complete-tag

Complete the current tag.

C-c C-z v HTML Load This Buffer in Browser

browse-url-of-file

Display this file in the default browser.

C-c C-z u HTML Browse URL at Point

browse-url-default-browser

Load the URL at point in default browser.

C-c M-h 1 HTML Insert Headers Header 1

tempo-template-html-header-1

Insert <h1></h1>.

C-c M-h 2 HTML Insert Headers Header 2

tempo-template-html-header-2

Insert <h2></h2>.

C-c M-h 3 HTML Insert Headers Header 3

tempo-template-html-header-3

Insert <h3></h3>.

C-c M-h 4 HTML Insert Headers Header 4

tempo-template-html-header-4

Insert <h4></h4>.

C-c M-h 5 HTML Insert Headers Header 5

tempo-template-html-header-5

Insert <h5></h5>.

C-c M-h 6 HTML Insert Headers Header 6

tempo-template-html-header-6

Insert <h6></h6>.

M-Enter HTML Insert Text Elements Paragraph

tempo-template-html-paragraph

Insert <p></p>.

C-c C-a l HTML Insert Hyperlinks Hyperlink

tempo-template-html-hyperlink

Insert <a href=""></a>.

C-c C-a n HTML Insert Hyperlinks Target

tempo-template-html-link-target

Insert <a name=""></a>.

C-c Enter HTML Insert Text Elements Line Break

tempo-template-html-line-break

Insert a literal line break, <br>.

C-c = HTML Insert Text Elements Horizontal Line

tempo-template-html-horizontal-line

Insert a horizontal rule, <hr>.

C-c C-z t HTML Insert Timestamp Delimiter

html-helper-insert-timestamp-delimiter-at-point

Insert timestamp delimiters.

C-c C-h t HTML Insert Structural Elements Title

tempo-template-html-title

Insert <title></title>.

C-c Tab a HTML Insert Inlined Images Image

tempo-template-html-image

Insert <img src="">.

C-c C-l u HTML Insert List Elements Unordered List

tempo-template-html-unordered-list

Insert <ul><li></li></ul>.

C-c C-l o HTML Insert List Elements Ordered List

tempo-template-html-ordered-list

Insert <ol><li></li></ol>.

C-c C-l t HTML Insert List Elements Definition Item

tempo-template-html-definition-item

Insert <dt><dd>.

C-c C-l l HTML Insert List Elements List Item

tempo-template-html-item

Insert <li></li>.

C-c C-l d HTML Insert List Elements Definition List

tempo-template-html-definition-list

Insert <dl><dt><dd></dl>.

C-c C-l m HTML Insert List Elements Menu List

tempo-template-html-menu-list

Insert <menu><li></li></menu>.

C-c C-l r HTML Insert List Elements Directory List

tempo-template-html-directorylist

Insert <dir><li></li></dir>.

C-c C-l i HTML Insert List Elements List Item

html-helper-smart-insert-item

Insert <li></li>.

C-c C-f z HTML Insert Form Elements Rest Form

tempo-template-html-reset-form

Insert <input type="RESET">.

C-c C-f b HTML Insert Form Elements Button

tempo-template-html-button

Insert <input type="BUTTON">.

C-c C-f m HTML Insert Form Elements Submit Form

tempo-template-html- submit-form

Insert <input type="SUBMIT">.

C-c C-f s HTML Insert Form Elements Selections

tempo-template-html-selections

Insert <select><option></select>.

C-c C-f o HTML Insert Form Elements Option

tempo-template-html-option

Insert <option>.

C-c C-f v HTML Insert Form Elements Option with Value

tempo-template-html-option-with-value

Insert <option value="">.

C-c C-f i HTML Insert Form Elements Image Field

tempo-template-html-input-image-field

Insert <input type="IMAGE">.

C-c C-f r HTML Insert Form Elements Radiobutton

tempo-template-html-input-radiobutton

Insert <input type="RADIO">.

C-c C-f c HTML Insert Form Elements Checkbox

tempo-template-html-checkbox

Insert <input type="CHECKBOX">.

C-c C-f p HTML Insert Form Elements Text Area

tempo-template-html-text-area

Insert <textarea></textarea>.

C-c C-f f HTML Insert Form Elements Form

tempo-template-html-form

Insert <form></form>.

C-c C-f t `HTML Insert Form Elements Text Field

tempo-template-html-text-field

Insert <input type="TEXT">.

C-c C-f h HTML Insert Form Elements Hidden Field

tempo-template-html-hidden-field

Insert <input type="HIDDEN">.

C-c M-l s HTML Insert Logical Styles Strong

tempo-template-html-strong

Insert <strong></strong>.

C-c M-l e HTML Insert Logical Styles Emphasized

tempo-template-html-emphasized

Insert <em></em>.

C-c M-l b HTML Insert Logical Styles Blockquote

tempo-template-html-blockquote

Insert <blockquote></blockquote>.

C-c M-l p HTML Insert Logical Styles Preformatted

tempo-template-html-preformatted

Insert <pre></pre>.

C-c C-p s HTML Insert Physical Styles Strikethru

tempo-template-html-strikethru

Insert <s></s>.

C-c C-p f HTML Insert Physical Styles Fixed

tempo-template-html-fixed

Insert <tt></tt>.

C-c C-p u HTML Insert Physical Styles Underline

tempo-template-html-underline

Insert <u></u>.

C-c C-p i HTML Insert Physical Styles Italic

tempo-template-html-italic

Insert <i></i>.

C-c C-p b HTML Insert Physical Styles Bold

tempo-template-html-bold

Insert <b></b>.

C-c C-p c HTML Insert Physical Styles Center

tempo-template-html-center

Insert <center></center>.

C-c C-p l HTML Insert Physical Styles Spanning Class

tempo-template-html-spanning-class

Insert <span class=""></span>.

C-c C-p 5 HTML Insert Physical Styles Spanning Style

tempo-template-html-spanning-style

Insert <span style=""></span>.

C-c C-s a HTML Insert Logical Styles Address

tempo-template-html-address

Insert <address></address>.

C-c M-l d HTML Insert Logical Styles Definition

tempo-template-html-definition

Insert <dfn></dfn>.

C-c M-l v HTML Insert Logical Styles Variable

tempo-template-html-variable

Insert <var></var>.

C-c M-l k HTML Insert Logical Styles Keyboard Input

tempo-template-html-keyboard

Insert <kbd></kbd>.

C-c M-l r HTML Insert Logical Styles Citation

tempo-template-html-citation

Insert <cite></cite>.

C-c M-l x HTML Insert Logical Styles Sample

tempo-template-html-sample

Insert <samp></samp>.

C-c M-l c HTML Insert Logical Styles Code

tempo-template-html-code

Insert <code></code>.

C-c C-h b HTML Insert Structural Elements Base

tempo-template-html-base

Insert <base href="">.

C-c C-h l HTML Insert Structural Elements Link

tempo-template-html-link

Insert <link href="">.

C-c C-h m HTML Insert Structural Elements Meta Name

tempo-template-html-meta-name

Insert <meta content="">.

C-c C-h n HTML Insert Structural Elements Nextid

tempo-template-html-nextid

Insert <nextid>.

C-c C-h i HTML Insert Structural Elements Isindex

tempo-template-html-isindex

Insert <isindex>.

C-c C-h B HTML Insert Structural Elements Body

tempo-template-html-body

Insert <body></body>.

C-c C-h H HTML Insert Structural Elements Head

tempo-template-html-head

Insert <head></head>.

C-c C-t t HTML Insert Tables Table

tempo-template-html-table

Insert <table></table>.

C-c C-t p HTML Insert Tables html table caption

tempo-template-html-html-table-caption

Insert <caption></caption>.

C-c C-t d HTML Insert Tables Table Data

tempo-template-html-table-data

Insert <TD></TD>.

C-c C-t h HTML Insert Tables Table Header

tempo-template-html-table-header

Insert <TH></TH>.

C-c C-t r

HTML Insert Tables Table Row

tempo-template-html-table-row

Insert <TR></TR>.




[1] SGML stands for standardized general markup language. Both XML and HTML are descendants of SGML.

[2] At this writing, there is no way to enter XHTML mode explicitly. If your file looks like an XHTML file, Emacs puts you in that mode automatically.

[3] Pay no attention to the fact that this is called SGML versus HTML name entity mode. Since HTML mode is derived from SGML mode, many commands that work with HTML have sgml in their names. Also, note that the command is called sgml-name-8bit-mode, a clear discrepancy with the minibuffer message.

[4] For some reason, perhaps the way SGML name entity mode is programmed, you can insert these entities only using key bindings. The mode fails to trap the equivalent commands and translate them into entities. For this reason, we focus on key bindings.

[6] The version we downloaded in August 2004 marked this file as alpha code, so don't be surprised if you find bugs. Visit the file to see if its status has changed.

[7] For this to work, you must invoke the command through the keyboard, either using its key binding or its command name. Using a menu option doesn't work.

[8] If M-Tab is trapped by the operating system to switch between applications (it is on Red Hat Linux), type Esc Tab instead.