3

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 2

4

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.

1
  • Would still need some help for a solution. Commented Jun 26, 2022 at 15:32
3

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.