The built-in command list-buffers creates a buffer called *Buffer List* which can be saved to a file using C-x C-s. Is there some way to automate this so that I can enter something like list-buffers-to-file and have the output file created automatically, without having to leave the buffer I'm working in?
When I execute list-buffers, the window I'm working in is split and a buffer named *Buffer List* appears in the lower pane. I then have to C-x o to move to the *Buffer List* buffer and save it, then C-x o back to the buffer I was working in and type C-x 1 to remove the other pane. I would like to avoid the splitting of the window, and actually do not need to see the *Buffer List* buffer at all, but I cannot figure out how to do this. All of the buffer-saving elisp commands seem to work on the current buffer only, which means having to leave the buffer I'm working in. There doesn't seem to be a command like save-other-buffer buffer-name file-to-save-in. Is there some way to do this?