Like, Control-A (select all) followed by delete?
Go to the begin of the buffer, go to the end (both set the mark), then cut:
M-< M-> C-w
C-x h + del
key clears the buffer
Note: This requires transient-mark-mode
to be enabled (which it is by default).
Old folks might like to call it hk rather than clear-buffer-permanently, and assign it to the nostalgic key sequence like so:
(define-key esc-map "\^[hk" 'hk)
That's the pre-Gnu TECO EMACS command to clear the buffer (ESC ESC wHole Kill).
These macros build on the answers given above. To start using them paste them into your .emacs then restart emacs or (while in the .emacs buffer) type M-x eval-buffer.
(defun clear-buffer ()
"clear whole buffer add contents to the kill ring"
(interactive)
(kill-region (point-min) (point-max))
)
(defun clear-buffer-permenantly ()
"clear whole buffer, contents is not added to the kill ring"
(interactive)
(delete-region (point-min) (point-max))
)
There is no shortcut, but you can define one... Follow this link to get a macro for clearing a buffer.
Select all in Emacs is:
C-x h
(technically, that's mark-whole-buffer) and kill-region (to kill the marked region, which is now the entire buffer) is:
C-w
If you want to delete the region without copying it to the kill-ring, you can use
M-x delete-region
instead. If you do this alot, you'll want to bind delete-region to a key/key combo.