From 1d41ee0c1a2ba6a529aa83d63b4eb4e5d0b4c630 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 27 Jan 2022 03:30:24 +0100 Subject: [PATCH] refactor(evil): use window-swap-states in +evil--window-swap Taking a look at the built in windmove functions shows that Emacs has a built in function for swapping windows called `window-swap-states`. Using this ensures the window state is maintained. Ref: #6023 Co-authored-by: luveti --- modules/editor/evil/autoload/evil.el | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/editor/evil/autoload/evil.el b/modules/editor/evil/autoload/evil.el index e44f71216..53644a2b0 100644 --- a/modules/editor/evil/autoload/evil.el +++ b/modules/editor/evil/autoload/evil.el @@ -69,10 +69,7 @@ the only window, use evil-window-move-* (e.g. `evil-window-move-far-left')." (with-selected-window that-window (switch-to-buffer (doom-fallback-buffer))) (setq that-buffer (window-buffer that-window))) - (with-selected-window this-window - (switch-to-buffer that-buffer)) - (with-selected-window that-window - (switch-to-buffer this-buffer)) + (window-swap-states this-window that-window) (select-window that-window)))) ;;;###autoload