I came across this gist
(defun swap-windows ()
"If you have 2 windows, it swaps them."
(interactive)
(cond ((not (= (count-windows) 2))
(message "You need exactly 2 windows to do this."))
(t
(let* ((w1 (first (window-list)))
(w2 (second (window-list)))
(b1 (window-buffer w1))
(b2 (window-buffer w2))
(s1 (window-start w1))
(s2 (window-start w2)))
(set-window-buffer w1 b2)
(set-window-buffer w2 b1)
(set-window-start w1 s2)
(set-window-start w2 s1)))))
today, which swaps the contents of the buffers in two windows, as long as there are exactly two windows. The problem for me is that I usually have ecb running, which creates 1 or more extra windows. I've never really done anything with elisp except tweak methods I get from other places, and this (hopefully) simple change is a bit above my current comprehension.
I spent some time looking through both the ecb information, and the emacs manual, but can't find a reasonable way to determine if there are exactly two non-ecb windows open.
I also tried using things like 'bury-buffer' on the ecb windows, so I could just assume the they wouldn't be at the front of the list, but that was a flawed approach to begin with.
So my question, is there a way to modify the gist to make it work with ecb? I'm assuming there is something special about ecb windows, but I couldn't find anything I could access.