Emacs 26.2 M-C-L is bound to switch-to-next-buffer. I have many files open but it's simply flopping between two. On my old XEmacs the same key cycled through all of them (and S-M-C-L did so backwards). I can't use that any more to find the exact function it was bound to.

Do I need a different function? Or does this function need an argument? (It seems to have no documentation.)

(To be clear: I have only one window open and it is not split in two.)

  • Does next-buffer C-x <RIGHT> and previous-buffer C-x <LEFT> behave the way you want? gnu.org/software/emacs/manual/html_node/emacs/…
    – lawlist
    Dec 11 '19 at 5:41
  • C-x <left> does what I want to do, thanks! C-x <right> is just alternating between two buffers though. Dec 11 '19 at 5:57
  • switch-to-next-buffer is not bound to a key by default, and is explicitly designed to switch between recent windows, which is the behaviour you are describing. next-buffer and previous-buffer should do what you want, as lawlist points out. If C-x <right> isn't doing what you want, check to see that it is actually bound to next-buffer; maybe there's something in your config that has altered that binding too.
    – Tyler
    Dec 11 '19 at 15:33
  • This question is likely a duplicate, but I can't find the dup quickly. Anyone?
    – Drew
    Dec 11 '19 at 15:52
  • > This question is likely a duplicate, but I can't find the dup quickly... Actually I think it's a bit weirder problem: my C-x <RIGHT> is only cycling between two files even though I have 10 open. It seems like somethings actually buggy or I broke it somehow. In other words, my issue isn't the one I thought it was... Dec 12 '19 at 1:32

Emacs provides two built-in functions named next-buffer with a default binding of C-x <RIGHT> and previous-buffer with a default binding of C-x <LEFT>:


  • thanks but next-buffer is not working as expected. If I have 10 files open it should cycle between all 10, right? It is only cycling between 2. Dec 12 '19 at 1:35
  • @SwissFrank Could you run emacs -Q and test this again? The default behaviour should be what you want it to be. If it only happens with your config, then something in your config must be changing the behaviour.
    – phils
    Dec 12 '19 at 5:05
  • Thanks Phils... this is pretty much the answer; if you write it up as such I'll select as answer. With -Q, C-x <right> works correctly. Without -Q, it doesn't work. The cause is that I had defined my own function: (defun switch-to-next-buffer () (interactive) (switch-to-buffer (other-buffer))) earlier, when experimenting I guess, and I left it defined but forgot about it. And I guess this switch-to-next-buffer is internally called by next-buffer (which is the binding for my C-x<right> according to ctrl-h ? c). Dec 12 '19 at 5:21

Try using bs-cycle-previous, bs-cycle-next which come with emacs. These use cycling rules you can configure, check their help to see options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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