Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Next: , Up: Basic


8.1 Inserting Text

To insert printing characters into the text you are editing, just type them. This inserts the characters you type into the buffer at the cursor (that is, at point; see Point). The cursor moves forward, and any text after the cursor moves forward too. If the text in the buffer is ‘FOOBAR’, with the cursor before the ‘B’, then if you type XX, you get ‘FOOXXBAR’, with the cursor still before the ‘B’.

To delete text you have just inserted, use the large key labeled <DEL>, <BACKSPACE> or <DELETE> which is a short distance above the <RET> or <ENTER> key. This is the key you normally use, outside Emacs, for erasing the last character that you typed. Regardless of the label on that key, Emacs thinks of it as <DEL>, and that's what we call it in this manual.

The <DEL> key deletes the character before the cursor. As a consequence, the cursor and all the characters after it move backwards. If you type a printing character and then type <DEL>, they cancel out.

On most computers, Emacs recognizes automatically which key ought to be <DEL>, and sets it up that way. But in some cases, especially with text-only terminals, you will need to tell Emacs which key to use for that purpose. If the large key not far above the <RET> or <ENTER> key doesn't delete backwards, you need to do this. See DEL Does Not Delete, for an explanation of how.

Most PC keyboards have both a <BACKSPACE> key a short ways above <RET> or <ENTER>, and a <DELETE> key elsewhere. On these keyboards, Emacs supports when possible the usual convention that the <BACKSPACE> key deletes backwards (it is <DEL>), while the <DELETE> key deletes “forwards,” deleting the character after point, the one underneath the cursor, like C-d (see below).

To end a line and start typing a new one, type <RET>. This inserts a newline character in the buffer. If point is in the middle of a line, the effect is to split the line. Typing <DEL> when the cursor is at the beginning of a line deletes the preceding newline, thus joining the line with the preceding line.

Emacs can split lines automatically when they become too long, if you turn on a special minor mode called Auto Fill mode. See Filling, for how to use Auto Fill mode.

If you prefer to have text characters replace (overwrite) existing text rather than shove it to the right, you can enable Overwrite mode, a minor mode. See Minor Modes.

Direct insertion works for printing characters and <SPC>, but other characters act as editing commands and do not insert themselves. If you need to insert a control character or a character whose code is above 200 octal, you must quote it by typing the character Control-q (quoted-insert) first. (This character's name is normally written C-q for short.) There are two ways to use C-q:

  • C-q followed by any non-graphic character (even C-g) inserts that character.
  • C-q followed by a sequence of octal digits inserts the character with the specified octal character code. You can use any number of octal digits; any non-digit terminates the sequence. If the terminating character is <RET>, it serves only to terminate the sequence. Any other non-digit terminates the sequence and then acts as normal input—thus, C-q 1 0 1 B inserts ‘AB’.

    The use of octal sequences is disabled in ordinary non-binary Overwrite mode, to give you a convenient way to insert a digit instead of overwriting with it.

When multibyte characters are enabled, if you specify a code in the range 0200 through 0377 octal, C-q assumes that you intend to use some ISO 8859-n character set, and converts the specified code to the corresponding Emacs character code. See Enabling Multibyte. You select which of the ISO 8859 character sets to use through your choice of language environment (see Language Environments).

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

A numeric argument to C-q specifies how many copies of the quoted character should be inserted (see Arguments).

Customization information: <DEL> in most modes runs the command delete-backward-char; <RET> runs the command newline, and self-inserting printing characters run the command self-insert, which inserts whatever character was typed to invoke it. Some major modes rebind <DEL> to other commands.


 
 
  Published under the terms of the GNU General Public License Design by Interspire