Scratch buffer
Table of Contents
I have been deep in emacs for over a decade but still never utilized the scratch buffer until I saw how much it was part of the workflow of a friend. I’ve now fixed may ways and just needed a fast way to open it, optionally in a side Window. I wrote up this quick command and bound it to a convenient hydra key and now I have one-stroke scratch buffer opening. I might need to install the immortal-scratch plugin if I find it getting closed on me, but I think I’ll be okay. Since I’m already in exwm this makes it handy on one of my global hydras.
(defun tsa/open-scratch (&optional new-window)
"Open the scratch buffer. With c-u, in other window."
(interactive "P")
(let ((scratch "*scratch*"))
(if new-window (switch-to-buffer-other-window scratch)
(switch-to-buffer scratch))))
I wrote this while preparing to post on Reddit and my browser was behaving poorly, so I can write in emacs and easily paste it into my browser.