Skip to main content
2 of 5
added 580 characters in body
Drew
  • 80.9k
  • 10
  • 125
  • 265

As @kuanyui says in a comment, next-buffer & previous-buffer are very quick, if you have only a few buffers to cycle among. (For more than a few, and for more buffer-choosing features, I use icicle-buffer.)

However, by default, next-buffer and previous-buffer are on a prefix key, C-x.

That means that they are not repeatable: you cannot just hit C-x <right> <right> <right>.... You must instead either bind these commands to different, repeatable keys, or you must use C-x <right> C-x <right> C-x <right>..., which is not very quick.

For repeatable versions of these commands, load library misc-cmds.el and remap the vanilla, unrepeatable versions to the repeatable ones defined there:

(global-set-key [remap previous-buffer] 'previous-buffer-repeat) (global-set-key [remap next-buffer] 'next-buffer-repeat) 

(Similarly, in the same library you will find a version of undo that is repeatable even when on a prefix key: undo-repeat.)


BTW, you can make pretty much any command repeatable (even on a prefix key), by using function repeat-command (from misc-cmds.el). This is all that was needed to define the repeatable version of next-buffer:

(defun previous-buffer-repeat () "Switch to the previous buffer in the selected window. You can repeat this by hitting the last key again..." (interactive) (require 'repeat nil t) ; Library `repeat.el' is in Emacs 22.1 and later (repeat-command 'next-buffer)) 
Drew
  • 80.9k
  • 10
  • 125
  • 265