GNU Emacs Manual - Deletion

Go to the first, previous, next, last section, table of contents.

### Deletion

`C-d`
  Delete next character (`delete-char`).
``DEL``
  Delete previous character (`delete-backward-char`).
`M-\`
  Delete spaces and tabs around point (`delete-horizontal-space`).
`M-`SPC``
  Delete spaces and tabs around point, leaving one space (`just-one-space`).
`C-x C-o`
  Delete blank lines around the current line (`delete-blank-lines`).
`M-^`
  Join two lines by deleting the intervening newline, along with any indentation following it (`delete-indentation`).

The most basic delete commands are `C-d` (`delete-char`) and `DEL` (`delete-backward-char`). `C-d` deletes the character after point, the one the cursor is "on top of." This doesn't move point. `DEL` deletes the character before the cursor, and moves point back. You can delete newlines like any other characters in the buffer; deleting a newline joins two lines. Actually, `C-d` and `DEL` aren't always delete commands; when given arguments, they kill instead, since they can erase more than one character this way.

The other delete commands are those which delete only whitespace characters: spaces, tabs and newlines. `M-\` (`delete-horizontal-space`) deletes all the spaces and tab characters before and after point. `M-`SPC`` (`just-one-space`) does likewise but leaves a single space after point, regardless of the number of spaces that existed previously (even zero).

`C-x C-o` (`delete-blank-lines`) deletes all blank lines after the current line. If the current line is blank, it deletes all blank lines preceding the current line as well (leaving one blank line, the current line).

`M-^` (`delete-indentation`) joins the current line and the previous line, by deleting a newline and all surrounding spaces, usually leaving a single space. See section Indentation.

Go to the first, previous, next, last section, table of contents.