Commit c1cea8a7 authored by Juri Linkov's avatar Juri Linkov

Move rotate-window-buffers to emacs.el from emacs.patches.el

parent e7d06274
......@@ -759,6 +759,29 @@ With C-u, C-0 or M-0, cancel the timer."
;;; window
;; Prev version posted to emacs-devel Subject: Re: Include buffer-move.el
;; Maybe add recipe to
(defun rotate-window-buffers (&optional n)
"Exchange buffers in all windows N times.
With positive N, it uses the window order of `window-list'.
With negative N, does this in the reverse order."
(interactive "p")
(let* ((ws (window-list))
(ls (mapcar (lambda (w)
(list (window-buffer w)
(window-point w)
(window-next-buffers w)
(window-prev-buffers w)))
(n (mod (or n 1) (length ws))))
(dolist (w (append (last ws n) (butlast ws n)))
(let ((l (pop ls)))
(set-window-buffer w (nth 0 l))
(set-window-point w (nth 1 l))
(set-window-next-buffers w (nth 2 l))
(set-window-prev-buffers w (nth 3 l))))))
(defun my-move-to-window-top (&optional arg)
"Position point to the top line of the window."
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment