Function: erase-buffer

erase-buffer is an interactive function defined in buffer.c.

Signature

(erase-buffer)

Documentation

Delete the entire contents of the current buffer.

Any narrowing restriction in effect (see narrow-to-region) is removed, so the buffer is truly empty after this.

Other relevant functions are documented in the buffer group.

Probably introduced at or before Emacs version 19.20.

Key Bindings

Shortdoc

;; buffer
(erase-buffer)

Source Code

// Defined in /usr/src/emacs/src/buffer.c
{
  Fwiden ();

  del_range (BEG, Z);

  current_buffer->last_window_start = 1;
  /* Prevent warnings, or suspension of auto saving, that would happen
     if future size is less than past size.  Use of erase-buffer
     implies that the future text is not really related to the past text.  */
  XSETFASTINT (BVAR (current_buffer, save_length), 0);
  return Qnil;
}