I am looking for a command that would switch to the buffer I most recently selected in the current window. The command mode-line-other-buffer
will switch to the most recently selected buffer not displayed in any window, regardless of whether it was selected in the current window or in some other window.
For illustration, suppose I have two open windows, 1 and 2, and four open buffers, A, B, C, D. Buffer A is displayed in window 1, and buffer C is displayed in window 2. Now suppose that,
- with point on A,
- I first switch to B, then
- select window 2, then
- switch to D, and finally
- select window 1.
At that point, the command mode-line-other-buffer
, if invoked, will switch to C. I would like an alternative command that, if invoked, would switch to A instead. Moreover, repeated invocations of this alternative command should toggle between B and A (just like repeated invocations of mode-line-other-buffer
toggle between B and C), since either of these buffers becomes the most recently selected buffer when the other buffer is selected.