I want to quickly alternate between the buffer I'm in and the last buffer I was in. Is there a built-in command for this?
I rolled my own, but I might rather use something built-in.
(defun alternate-buffer ()
"Alternate between the current buffer and the previous."
(interactive)
(switch-to-buffer (caar (window-prev-buffers))))
I've checked M-x apropos
and searched for "buffer", but I haven't located such a command.
C-x b Enter
not the same ?nil
toswitch-to-buffer
switches to the previous buffer that you selected in the current frame. This is slightly different as your function seems to only consider the current window history. Is that what you intended?alternate-buffer
in that case, as it feels more "predictable" for the way that I use windows.