

emacsで、`C-x 3`して、画面を左右に２分割したあとに、左右のwindowを入れ替えるにはどうすればよいでしょうか？


CC BY-SA 3.0
2016-05-21T04:12:40.263
25057
2016-05-21T05:24:40.117
9596
question
emacs
emacsで縦に分割した画面を左右で入れ替えたい


画面が2分割されている時に、それらの位置を入れ替える関数です。

[code]

    ;; from http://www.emacswiki.org/emacs/TransposeWindows
    (defun swap-window-positions ()         ; Stephen Gildea
      "*Swap the positions of this window and the next one."
      (interactive)
      (let ((other-window (next-window (selected-window) 'no-minibuf)))
        (let ((other-window-buffer (window-buffer other-window))
              (other-window-hscroll (window-hscroll other-window))
              (other-window-point (window-point other-window))
              (other-window-start (window-start other-window)))
          (set-window-buffer other-window (current-buffer))
          (set-window-hscroll other-window (window-hscroll (selected-window)))
          (set-window-point other-window (point))
          (set-window-start other-window (window-start (selected-window)))
          (set-window-buffer (selected-window) other-window-buffer)
          (set-window-hscroll (selected-window) other-window-hscroll)
          (set-window-point (selected-window) other-window-point)
          (set-window-start (selected-window) other-window-start))
        (select-window other-window)))
    
[/code]


CC BY-SA 3.0
2016-05-21T05:00:30.373
25059
2016-05-21T05:24:40.117
2016-05-21T05:24:40.117
754
754
25057
answer