If I accidentally closed the scratch buffer in Emacs, how do I create a new scratch buffer?
(global-set-key (kbd "C-x M-z")
'(lambda ()
(interactive)
(switch-to-buffer "*scratch*")))
This will not only quickly switch to *scratch*
buffer(since I do this frequently), but recreate a *scratch*
buffer and enable lisp-interaction-mode
automatically if you kill it accidentally. Change the binding as you like.