branch: elpa/iwindow commit bfc5e97dfeb30c90848ced7f976704102d960863 Author: Akib Azmain Turja <a...@disroot.org> Commit: Akib Azmain Turja <a...@disroot.org>
Add iwindow-swap --- iwindow.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/iwindow.el b/iwindow.el index 90775e4ae6..9fe86a58f9 100644 --- a/iwindow.el +++ b/iwindow.el @@ -242,5 +242,19 @@ WINDOWS and CALLBACK is described in the docstring of (not (eq window (selected-window))))))) (select-window window))) +;;;###autoload +(defun iwindow-swap () + "Swap buffers of current window and WINDOW." + (interactive) + (when-let ((window (iwindow-choose + (lambda (window) + (not (eq window (selected-window))))))) + (unless (eq (window-frame window) (selected-frame)) + (select-frame-set-input-focus (window-frame window))) + (let ((current-buffer (window-buffer (selected-window)))) + (set-window-buffer (selected-window) (window-buffer window)) + (set-window-buffer window current-buffer) + (select-window window)))) + (provide 'iwindow) ;;; iwindow.el ends here