Would like to use two scratch buffers on two side-by-side windows. How can I do this thing? Can only also ask for more than two scratch buffers that can be named?
2 Answers
In the first scratch buffer, do C-x 4 b (switch-to-buffer-other-window) and supply second-scratch (or whatever) as argument. In your new buffer, do M-x lisp-interaction-mode and that's it.
Doing this from elisp is an exercise for the reader.
The point is that there is nothing magic about a scratch buffer: it is simply a buffer with major-mode lisp-interaction-mode.
- Would still need some help for a solution.Dilna– Dilna2022-06-26 15:32:28 +00:00Commented Jun 26, 2022 at 15:32
I whipped this up based off of the other answer.
(defun mw::make-scratch-buffer (name) (interactive "sNew scratch buffer's name (don't include asterisks): " name) (progn (switch-to-buffer-other-window (format "*%s*" name)) (lisp-interaction-mode))) Some people might think that automagically adding asterisks like that is annoying. Others might prefer to use switch-to-buffer instead of switch-to-buffer-other-window. But hopefully this is something you and other people can adapt and build on.