Skip to content

Instantly share code, notes, and snippets.

@yaotti
Created December 1, 2008 04:38
Show Gist options
  • Save yaotti/30623 to your computer and use it in GitHub Desktop.
Save yaotti/30623 to your computer and use it in GitHub Desktop.
;; http://www.bookshelf.jp/soft/meadow_30.html#SEC400
(defun swap-screen()
"Swap two screen,leaving cursor at current window."
(interactive)
(let ((thiswin (selected-window))
(nextbuf (window-buffer (next-window))))
(set-window-buffer (next-window) (window-buffer))
(set-window-buffer thiswin nextbuf)))
(defun swap-screen-with-cursor()
"Swap two screen,with cursor in same buffer."
(interactive)
(let ((thiswin (selected-window))
(thisbuf (window-buffer)))
(other-window 1)
(set-window-buffer thiswin (window-buffer))
(set-window-buffer (selected-window) thisbuf)))
(define-key global-map (kbd "C-x m") 'swap-screen)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment