All pastes #1906694 Raw Edit

Transpose Windows

public text v1 · immutable
#1906694 ·published 2010-07-23 09:33 UTC
rendered paste body
(require 'cl)                           ; for mapcar* and others
(defun rb-rotate-buffers (&optional arg)
  "Rotates the buffers currently displayed."
  (interactive "p")
  (let* ((windows (window-list))
         (buffers (mapcar 'window-buffer windows)))
    (mapcar* '(lambda (w b) (set-window-buffer w b))
             windows
             (nconc (rest buffers) (list (first buffers))))))