(X)HTML-mode
Normally Emacs enters html-mode
when it opens a file whose
name ends in ".html" or ".htm". You can also switch to
this mode by invoking the command html-mode
.
The file is opened in xhtml-mode
if it contains an XML
declaration, usually the first line:
<?xml version="1.0" encoding="iso-8859-1"?>
See http://en.wikipedia.org/wiki/XML for XML (Extensible
Markup Language).
In this mode there are two new menus, HTML and SGML.
To see the description of the mode, do C-h m
.
Here are a few more often used commands. For most of them the completion
mechanism works.
See this link
at https://www.gnu.org/software/emacs/manual/ for more
[as of 2014.10].
C-c C-t
- purpose: insert a tag (you can choose from the tags offered or
type a new one); for some tags it will also help you add attributes.
- remarks: if there is a highlighted region, the tag/end-tag is
wrapped around the region.
C-c /
- purpose: close the currently open tag
C-c C-d
- purpose: remove a tag, including the attributes and the end-tag.
- remarks: the point should be inside the < and > defining the
tag or the end-tag.
C-c C-a
- purpose: add attributes; you can choose from those offered, or
type a new one (for some attributes you are able to input the value too).
- remarks: the point should be inside the < and > defining the
tag; the attributes are inserted where the point is.
C-c C-v
- purpose: open the current buffer in a browser (without worrying
about the read-permission).
- remarks: the next time this command is invoked, the buffer is
reloaded in the same browser window.
comment-region
- purpose: comment and uncomment the region
- remarks: to uncomment the region use
uncomment-region
(or, precede the command with C-u
, i.e. type C-u M-x
comment-region
).
C-c C-i
, same as C-c TAB
- purpose: Toggle visibility of existing tags