emacs swaps buffer between two windows
时间:2009-07-24 来源:dealover
I wrote this code yesterday evening. It swaps buffer between two windows in emacs.
It doesn't work that the number of window is not equals TWO.
[code]
(defun qw-swap-window-split ()
"This code swap two buffers in two windows, arranged left-right or
up-down. It works for one frame of two windows."
(interactive)
(if (= (count-windows) 2)
(let* ((cur-buf (window-buffer))
(next-buf (window-buffer (next-window))))
(set-window-buffer (selected-window) next-buf)
(set-window-buffer (next-window) cur-buf))))
[/code]
It doesn't work that the number of window is not equals TWO.
[code]
(defun qw-swap-window-split ()
"This code swap two buffers in two windows, arranged left-right or
up-down. It works for one frame of two windows."
(interactive)
(if (= (count-windows) 2)
(let* ((cur-buf (window-buffer))
(next-buf (window-buffer (next-window))))
(set-window-buffer (selected-window) next-buf)
(set-window-buffer (next-window) cur-buf))))
[/code]
相关阅读 更多 +