From 54049bbe208f1626f42959b13fa215d814c0c193 Mon Sep 17 00:00:00 2001 From: drcxd Date: Wed, 4 Feb 2026 17:48:29 +0800 Subject: [PATCH] Use `window-sap-states' to implement swapping window * switch-window.el: Use `window-swap-states` rather than `set-window-buffer' to avoid only changing buffer but not fringes/margins etc.. --- switch-window.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/switch-window.el b/switch-window.el index 88a8d30..a1a02ad 100644 --- a/switch-window.el +++ b/switch-window.el @@ -222,6 +222,7 @@ (require 'cl-lib) (require 'quail) +(require 'window) (require 'switch-window-asciiart) (require 'switch-window-mvborder) @@ -690,8 +691,7 @@ won't take effect, and no buffers will be switched." (progn (select-window window1) (message "The selected window has a dedicated buffer: `%s'" (buffer-name buffer2))) - (set-window-buffer window2 buffer1 t) - (set-window-buffer window1 buffer2 t) + (window-swap-states window1 window2) (if keep-focus (switch-window--select-window window1))))))