Go to the previous, next section.
All of the deletion functions operate on the current buffer, and all
return a value of nil. In addition to these functions, you can
also delete text using the "kill" functions that save it in the kill
ring; some of these functions save text in the kill ring in some cases
but not in the usual case. See section The Kill Ring.
This function deletes the entire text of the current buffer, leaving it
empty. If the buffer is read-only, it signals a buffer-read-only
error. Otherwise, it deletes the text without asking for any
confirmation. The value is always nil.
Normally, deleting a large amount of text from a buffer inhibits further
auto-saving of that buffer "because it has shrunk". However,
erase-buffer does not do this, the idea being that the future
text is not really related to the former text, and its size should not
be compared with that of the former text.
Command: delete-region start end
This function deletes the text in the current buffer in the region
defined by start and end. The value is nil.
Command: delete-char count &optional killp
This function deletes count characters directly after point, or
before point if count is negative. If killp is
non-nil, then it saves the deleted characters in the kill ring.
In an interactive call, count is the numeric prefix argument, and killp is the unprocessed prefix argument. Therefore, if a prefix argument is supplied, the text is saved in the kill ring. If no prefix argument is supplied, then one character is deleted, but not saved in the kill ring.
The value returned is always nil.
Command: delete-backward-char count &optional killp
This function deletes count characters directly before point, or
after point if count is negative. If killp is
non-nil, then it saves the deleted characters in the kill ring.
In an interactive call, count is the numeric prefix argument, and killp is the unprocessed prefix argument. Therefore, if a prefix argument is supplied, the text is saved in the kill ring. If no prefix argument is supplied, then one character is deleted, but not saved in the kill ring.
The value returned is always nil.
Command: backward-delete-char-untabify count &optional killp
This function deletes count characters backward, changing tabs
into spaces. When the next character to be deleted is a tab, it is
first replaced with the proper number of spaces to preserve alignment
and then one of those spaces is deleted instead of the tab. If
killp is non-nil, then the command saves the deleted
characters in the kill ring.
If count is negative, then tabs are not changed to spaces, and the
characters are deleted by calling delete-backward-char with
count.
In an interactive call, count is the numeric prefix argument, and killp is the unprocessed prefix argument. Therefore, if a prefix argument is supplied, the text is saved in the kill ring. If no prefix argument is supplied, then one character is deleted, but not saved in the kill ring.
The value returned is always nil.
Go to the previous, next section.