Currently using GNU Emacs 23.1.1.

I've used xemacs since the late 90s and am only now switching to proper emacs.

If I had my xemacs window split into a top buffer and bottom buffer, I could move the keyboard focus between them with ctrl-tab. (I cannot remember if that's something I wrote myself 20+ years ago, or was a standard mapping, but checking my config files I don't think I wrote it myself.)

There are similar questions about rotating between buffers, but, I think, keeping the focus in the same sub-window. That's not my question, but just to be clear, the following is something I find very useful but isn't what this current question is asking. I probably have the wrong terminology, but the following code changes the buffer within the current sub-window. Instead I want to leave all the sub-windows looking at their current buffers, and instead move focus to the next sub-wind.

(defun switch-to-next-buffer () (interactive) (switch-to-buffer (other-buffer)))

  • 1
    Are you looking for other-window bound to C-x o?
    – Tobias
    Oct 29, 2019 at 9:06
  • Yes Tobias, that seems to be it. If you could provide that as an answer I'll mark it as correct. BTW is there another command I could bind to ctrl-shift-tab to go backwards, should I have many windows? Oct 29, 2019 at 9:17

1 Answer 1


Gnu Emacs has the function other-window which is bound to C-x o.

The relevant section from the doc string of other-window:

(other-window COUNT &optional ALL-FRAMES)
Select another window in cyclic ordering of windows. COUNT specifies the number of windows to skip, starting with the selected window, before making the selection. If COUNT is positive, skip COUNT windows forwards. If COUNT is negative, skip -COUNT windows backwards. COUNT zero means do not skip any window, so select the selected window. In an interactive call, COUNT is the numeric prefix argument.

So the keysequence C-<minus> C-x o gives you the inverse of C-x o. Note that C-<minus> stands for the numeric prefix arg -1.

  • that anticipated my next question--how to go backwards--as well; thanks! Oct 30, 2019 at 0:29

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.