If there already was a buffer named "test", the new buffer would be
named something else like "test<2>". The kill-buffer call would then
kill some unrelated buffer instead of the intended one.
Killing the buffer inside with-current-buffer allows for buffers with
any name.
If there already was a buffer named "test", the new buffer would be named something else like "test<2>". The kill-buffer call would then kill some unrelated buffer instead of the intended one. Killing the buffer inside with-current-buffer allows for buffers with any name.