Emacs: New Empty Buffer 🚀

By Xah Lee. Date: . Last updated: .

Here's a command to open a new empty buffer, without prompting for a name.

put this in your Emacs Init File:

(defun xah-new-empty-buffer ()
  "Create a new empty buffer.
Returns the buffer object.
New buffer is named untitled, untitled<2>, etc.

Warning: new buffer is not prompted for save when killed, see `kill-buffer'.
Or manually `save-buffer'

URL `http://xahlee.info/emacs/emacs/emacs_new_empty_buffer.html'
Version: 2017-11-01 2022-04-05"
  (let ((xbuf (generate-new-buffer "untitled")))
    (switch-to-buffer xbuf)
    (funcall initial-major-mode)

You can give it a easy key such as F7. [see Emacs Keys: Define Key]

Start Emacs with Empty Buffer

(setq initial-buffer-choice 'xah-new-empty-buffer)