From 95a569df5a0d8127b09045ba96ff64c626f866a3 Mon Sep 17 00:00:00 2001 From: Thomas Ulmer Date: Fri, 16 Jan 2026 22:17:11 -0800 Subject: emacs: fix quick layout swap to work (fail) on multiple frames --- emacs/init.el | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'emacs') diff --git a/emacs/init.el b/emacs/init.el index 5c8aa17..602b2fa 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -271,13 +271,18 @@ With ARG, open a Dired buffer instead." (defun my/layout-swap (&optional arg) "Swap between the two saved window configurations. With ARG, don't save the current layout." - (interactive "P") + (interactive "p") + (messaghe "%s" arg) (let ((left (car my/layout-pair)) - (right (cdr my/layout-pair))) - (unless arg - (setq left (current-window-configuration))) - (set-window-configuration right t t) - (setq my/layout-pair (cons right left)))) + (right (cdr my/layout-pair)) + (cwc (current-window-configuration))) + (cond + ((>= arg 16) (setq my/layout-pair (cons cwc cwc))) + ((eq (selected-frame) (window-configuration-frame right)) + (unless (>= arg 4) (setq left cwc)) + (set-window-configuration right t t) + (setq my/layout-pair (cons right left))) + (t (message "Quick layout swap only works with same frame!"))))) (progn ; my global keybinds (define-minor-mode my/keys-mode -- cgit v1.2.3