branch: externals/window-commander commit 721d0208f7746b1127c847f4e5bf109c9686449c Author: Daniel Semyonov <cm...@dsemy.com> Commit: Daniel Semyonov <cm...@dsemy.com>
Update the window list after deleting a frame * swsw.el (swsw-update): Add optional '_frame' argument. (swsw-mode): Add hook to run 'swsw-update' to 'after-delete-frame-functions'. --- swsw.el | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/swsw.el b/swsw.el index 421dce92c7..0aade5091c 100644 --- a/swsw.el +++ b/swsw.el @@ -112,7 +112,16 @@ If set to `lighter', use the mode line lighter of `swsw-mode'" div (1+ div)))) -(defun swsw-update () +(defun swsw-update-window (window) + "Update information for WINDOW." + (let ((id (if (window-minibuffer-p window) + swsw-minibuffer-id + (pop swsw-ids)))) + (when id + (push (cons id window) swsw-window-list) + (set-window-parameter window 'swsw-id id)))) + +(defun swsw-update (&optional _frame) "Update information for all windows." (setq swsw-window-list nil ;; Build a list of all possible IDs for the current length. @@ -123,15 +132,6 @@ If set to `lighter', use the mode line lighter of `swsw-mode'" (apply #'swsw--get-possible-ids char-lists))) (walk-windows #'swsw-update-window nil swsw-scope)) -(defun swsw-update-window (window) - "Update information for WINDOW." - (let ((id (if (window-minibuffer-p window) - swsw-minibuffer-id - (pop swsw-ids)))) - (when id - (push (cons id window) swsw-window-list) - (set-window-parameter window 'swsw-id id)))) - (defun swsw-format-id (window) "Format an ID string for WINDOW." (format swsw-id-format @@ -151,12 +151,14 @@ If set to `lighter', use the mode line lighter of `swsw-mode'" (funcall swsw-display-function t)) (add-hook 'window-configuration-change-hook #'swsw-update) (add-hook 'minibuffer-setup-hook #'swsw-update) - (add-hook 'minibuffer-exit-hook #'swsw-update)) + (add-hook 'minibuffer-exit-hook #'swsw-update) + (add-hook 'after-delete-frame-functions #'swsw-update)) (unless (eq swsw-display-function 'lighter) (funcall swsw-display-function nil)) (remove-hook 'window-configuration-change-hook #'swsw-update) (remove-hook 'minibuffer-setup-hook #'swsw-update) - (remove-hook 'minibuffer-exit-hook #'swsw-update))) + (remove-hook 'minibuffer-exit-hook #'swsw-update) + (remove-hook 'after-delete-frame-functions #'swsw-update))) (defun swsw--read-id (len) "Read a window ID of length LEN using `read-char'."