[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/window-commander dc96f71732 122/170: Update window info
From: |
ELPA Syncer |
Subject: |
[elpa] externals/window-commander dc96f71732 122/170: Update window information when switching frames |
Date: |
Wed, 28 Jun 2023 19:00:32 -0400 (EDT) |
branch: externals/window-commander
commit dc96f7173210a7af1280ef43c443459b8e40cb45
Author: Daniel Semyonov <daniel@dsemy.com>
Commit: Daniel Semyonov <daniel@dsemy.com>
Update window information when switching frames
* swsw.el (swsw--current-frame): New variable holding the last frame
from which 'swsw--update' was called.
(swsw--update-frame): New function which calls 'swsw--update' if
'swsw--current-frame' differs from the selected frame and 'swsw-scope'
isn't t.
(swsw--update): Set 'swsw--current-frame'.
(swsw-mode): Hook 'swsw--update-frame' to run through
'window-state-change-hook'.
---
NEWS | 3 +++
swsw.el | 17 ++++++++++++++++-
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index 136d065a0b..3383649328 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,9 @@ See the end of the file for an explanation of the versioning
scheme.
* 2.1.0
+** Update window information when switching frames.
+This fixes several issues when 'swsw-scope' isn't t.
+
** Make 'swsw-select' and 'swsw-delete' respect 'swsw-scope'.
Previously, 'swsw-select' and 'swsw-delete' would not select/delete
the only other window if it was on a different frame and 'swsw-scope'
diff --git a/swsw.el b/swsw.el
index a777746ed2..65fc6aeac3 100644
--- a/swsw.el
+++ b/swsw.el
@@ -154,6 +154,10 @@ If set to `lighter', use a mode line lighter."
"Amount of windows that have been assigned an ID.")
(put 'swsw-window-count 'risky-local-variable t)
+(defvar swsw--current-frame nil
+ "Current frame (set by `swsw--update'), used to detect frame changes.")
+(put 'swsw--current-frame 'risky-local-variable t)
+
(defun swsw--get-scope ()
"Return the current scope in which windows should be tracked."
(if (eq swsw-scope 'current)
@@ -203,12 +207,21 @@ If set to `lighter', use a mode line lighter."
(set-window-parameter window 'swsw-id id)
(setq swsw-window-count (1+ swsw-window-count))))
+(defun swsw--update-frame ()
+ "Run `swsw--update' if the current frame isn't `swsw--current-frame'.
+This check is skipped (and this function does nothing) if `swsw-scope'
+is t."
+ (unless (or (eq (swsw--get-scope) t)
+ (eq swsw--current-frame (selected-frame)))
+ (swsw--update)))
+
(defun swsw--update (&optional _frame)
"Update information for all windows."
(setq swsw--id-map (make-sparse-keymap))
(set-keymap-parent swsw--id-map swsw-command-map)
(setq swsw--id-counter nil
- swsw-window-count 0)
+ swsw-window-count 0
+ swsw--current-frame (selected-frame))
;; Clear and resize `swsw--id-counter' according to the ID length.
(dotimes (_var (swsw--get-id-length))
(push 0 swsw--id-counter))
@@ -351,12 +364,14 @@ selection:
(unless (eq swsw-display-function 'lighter)
(funcall swsw-display-function t))
(add-hook 'window-configuration-change-hook #'swsw--update)
+ (add-hook 'window-state-change-hook #'swsw--update-frame)
(add-hook 'minibuffer-setup-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 'window-state-change-hook #'swsw--update-frame)
(remove-hook 'minibuffer-setup-hook #'swsw--update)
(remove-hook 'minibuffer-exit-hook #'swsw--update)
(remove-hook 'after-delete-frame-functions #'swsw--update)))
- [elpa] externals/window-commander 1c19d22100 108/170: ; Add links to relevant part of the manual to user options, (continued)
- [elpa] externals/window-commander 1c19d22100 108/170: ; Add links to relevant part of the manual to user options, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander af63260c0e 134/170: ; Update package URL to https://dsemy.com/projects/swsw, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 307b891692 127/170: ; Small fix in NEWS, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 6e036789af 103/170: ; Small Makefile modifications, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 2a8c7c6533 126/170: ; Document the bump to Emacs version 27.1, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander dee158840a 100/170: ; Indicate that ELPA installation is not yet available, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 4ceacd0330 132/170: Indicate that some functions are for interactive use only, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 2e4ca2b354 091/170: ; Don't specify -r when issuing rm in the Makefile's clean target, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander bd1e527d83 121/170: * swsw.el (swsw-select, swsw-delete): Respect 'swsw-scope', ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 98c3bf944f 109/170: ; Improvement for swsw-mode's docstring, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander dc96f71732 122/170: Update window information when switching frames,
ELPA Syncer <=
- [elpa] externals/window-commander db5cd237a7 125/170: ; Documentation improvements, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 13c92db0de 138/170: ; Fix build manifest, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander dd65e7c8af 139/170: ; Update copyright years, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 8b8c353938 143/170: ; Generate swsw-pkg.el' automatically, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 57e9986858 141/170: ; Small documentation fixes, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 9f3b010d65 147/170: ; Indicate ELPA installation is now possible in the README, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 0d7bf97dbb 142/170: ; Prepare for NonGNU ELPA inclusion, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 2b43f66c82 145/170: ; Use 'kbd' instead of vector notation for 'define-key' example, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander c864e6d524 144/170: ; Add change log for version 2.1.1, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 57a040f4be 140/170: ; Indicate the mailing list is the "maintainer" of the package, ELPA Syncer, 2023/06/28