Next / Previous / Contents / Shipman's homepage

5.2. The completion command

C-enter or M-tab Completion. If emacs is running in its own window, use C-enter, otherwise use M-tab.

The action of this command is somewhat complex. This command can be used to finish typing a tag or attribute name once you have entered an unambiguous substring.

For example, if you are writing XHTML and you enter “<tab” somewhere that a table element is allowed, and then request completion, emacs will add the rest of the characters of the start tag so you will then have “<table”.

As another example, suppose you have typed “<table b” and you then invoke completion. Since the only attribute of a table element that starts with b is border, after completion you will see “<table border="”. Typing the attribute value and the closing “>” sequence are up to you.

If the characters you typed can be the initial characters of more than one element or attribute name, the screen will split and you will see a list of the permissible names in the other half of the screen. You will be prompted in the minibuffer with “Tag:”; type enough additional characters to make the choice unambiguous and then press enter, and the completion will be added to your document.

If you can't remember a tag name, you can type just the “<” symbol and then invoke completion. The split screen will display all the permissible tags at the cursor's location.

If you are creating a start tag and can't remember an attribute name, just type one space and invoke completion. For example, if you have typed “<table ” (note the space after the tag name) and you invoke completion, the split screen will show you all the possible attributes of the table element.