Next: , Up: Basic   [Contents][Index]

7.1 Inserting Text

You can insert an ordinary graphic character (e.g., ‘a’, ‘B’, ‘3’, and ‘=’) by typing the associated key. This adds the character to the buffer at point. Insertion moves point forward, so that point remains just after the inserted text. See Point.

To end a line and start a new one, type RET (newline). (The RET key may be labeled Return or Enter on your keyboard, but we refer to it as RET in this manual.) This command inserts a newline character into the buffer, then indents (see Indentation) according to the major mode. If point is at the end of the line, the effect is to create a new blank line after it and indent the new line; if point is in the middle of a line, the line is split at that position. To turn off the auto-indentation, you can either disable Electric Indent mode (see Indent Convenience) or type C-j, which inserts just a newline, without any auto-indentation.

As we explain later in this manual, you can change the way Emacs handles text insertion by turning on minor modes. For instance, the minor mode called Auto Fill mode splits lines automatically when they get too long (see Filling). The minor mode called Overwrite mode causes inserted characters to replace (overwrite) existing text, instead of shoving it to the right. See Minor Modes.

Only graphic characters can be inserted by typing the associated key; other keys act as editing commands and do not insert themselves. For instance, DEL runs the command delete-backward-char by default (some modes bind it to a different command); it does not insert a literal ‘DEL’ character (ASCII character code 127).

To insert a non-graphic character, or a character that your keyboard does not support, first quote it by typing C-q (quoted-insert). There are two ways to use C-q:

To use decimal or hexadecimal instead of octal, set the variable read-quoted-char-radix to 10 or 16. If the radix is 16, the letters a to f serve as part of a character code, just like digits. Case is ignored.

Alternatively, you can use the command C-x 8 RET (insert-char). This prompts for the Unicode name or code-point of a character, using the minibuffer. If you enter a name, the command provides completion (see Completion). If you enter a code-point, it should be as a hexadecimal number (the convention for Unicode), or a number with a specified radix, e.g., #o23072 (octal); See Integer Basics in The Emacs Lisp Reference Manual. The command then inserts the corresponding character into the buffer. For example, both of the following insert the infinity sign (Unicode code-point U+221E):

C-x 8 RET infinity RET
C-x 8 RET 221e RET

A numeric argument to C-q or C-x 8 RET specifies how many copies of the character to insert (see Arguments).

Next: , Up: Basic   [Contents][Index]