Allow to pop current buffer and move it with "M" during dispatch

ace-window.el (aw-move-window): New defun.

During dispatch, while in window-1, press "M" and select window-2.
The buffer currently in window-1 will move to window-2.
The most recently selected buffer will move to window-1.

Fixes #56

Use case: suppose you have many windows and you call
`describe-function'. It pops up *Help* replacing a necessary buffer.
The you can e.g. "M-p M a" to move the *Help* buffer to replace a less
necessary buffer in window "a", while restoring the necessary buffer
that *Help* previously replaced.
old-master
Oleh Krehel 11 years ago
parent 97a2f9340b
commit 9aec100f72
  1. 9
      ace-window.el

@ -250,6 +250,7 @@ LEAF is (PT . WND)."
(defvar aw-dispatch-alist
'((?x aw-delete-window " Ace - Delete Window")
(?m aw-swap-window " Ace - Swap Window")
(?M aw-move-window " Ace - Move Window")
(?n aw-flip-window)
(?v aw-split-window-vert " Ace - Split Vert Window")
(?b aw-split-window-horz " Ace - Split Horz Window")
@ -472,6 +473,14 @@ Windows are numbered top down, left to right."
(swap-windows window this-window)
(swap-windows this-window window))))))
(defun aw-move-window (window)
"Move the current buffer to WINDOW.
Switch the current window to the previous buffer."
(let ((buffer (current-buffer)))
(switch-to-buffer (other-buffer))
(aw-switch-to-window window)
(switch-to-buffer buffer)))
(defun aw-split-window-vert (window)
"Split WINDOW vertically."
(select-window window)

Loading…
Cancel
Save