How can I make Emacs toggle between the previous buffer within a single window (e.g. ignoring buffer changes in other windows)?

  • Like this?: (previous-buffer) [It is bound to <XF86Back>, C-x <C-left>, C-x <left>, <menu-bar> <buffer> <previous-buffer>.] and (next-buffer) [It is bound to C-x <C-right>, C-x <right>, <menu-bar> <buffer> <next-buffer>.]
    – lawlist
    Commented Jan 20, 2015 at 21:34
  • These commands were the first things I tried. They appear to use a global stack to decide what the next and previous buffers were. I'm interested in remembering the previous buffer for a particular window.
    – wdkrnls
    Commented Jan 20, 2015 at 21:37
  • Perhaps this is not possible without window-local-variables?
    – wdkrnls
    Commented Feb 4, 2015 at 4:53
  • I found this question and was really excited! Less excited when I saw there was no answer :( Commented Jun 22, 2015 at 19:19

2 Answers 2


I believe you are looking for winner-mode.

Winner mode, when activated, allows you to navigate windows, together with the buffer contents that was there at the time, by C-c left and C-c right.

  • 1
    I've used winner-mode in the past, and I don't think it does what I am describing. Basically, I'm looking for a (previous-window-local-buffer) or a (toggle-window-local-buffer). The latter naming makes it more obvious I'm looking for a command which switches between one of two states.
    – wdkrnls
    Commented Feb 4, 2015 at 4:49

You can use a keyboard macro

(define-key global-map [(control tab)] (kbd "C-x b <return>")) 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.