[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swsw dc96f71732 122/146: Update window information when sw
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swsw dc96f71732 122/146: Update window information when switching frames |
Date: |
Wed, 25 May 2022 02:59:53 -0400 (EDT) |
branch: elpa/swsw
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)))
- [nongnu] elpa/swsw ca14f1d0c5 107/146: Mark some variables as risky local variables, (continued)
- [nongnu] elpa/swsw ca14f1d0c5 107/146: Mark some variables as risky local variables, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 57e9986858 141/146: ; Small documentation fixes, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 3882424448 099/146: ; Bump to version 2.0.2, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw ccab7194a7 133/146: Use 'custom-initialize-changed' to initialize some user options, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 5446df0f3e 059/146: * swsw.el (swsw--get-id-length): Fix the calculation of the ID length, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw af99790728 123/146: ; Various cosmetic changes to NEWS, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw af63260c0e 134/146: ; Update package URL to https://dsemy.com/projects/swsw, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw ff38ec1c24 124/146: ; Bump required Emacs version to 27.1 due to 'window-state-change-hook', ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw c378be9bae 130/146: ; Load 'subr-x' when compiling, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 2e4ca2b354 091/146: ; Don't specify -r when issuing rm in the Makefile's clean target, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw dc96f71732 122/146: Update window information when switching frames,
ELPA Syncer <=
- [nongnu] elpa/swsw ccf0d780a5 078/146: Add support for custom window commands, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 2a8c7c6533 126/146: ; Document the bump to Emacs version 27.1, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 61700ece84 135/146: ; Fix indentation in a few places, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 6e036789af 103/146: ; Small Makefile modifications, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 48e4811965 089/146: ; Remove (incorrect) description of the 'make all' target in the Makefile, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw def4d94e43 013/146: ; Update README to better reflect the current state of the package, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 98c3bf944f 109/146: ; Improvement for swsw-mode's docstring, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw c153d9a32c 087/146: ; Add version information to customizable variables, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw e774ead908 104/146: ; Update mail address, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 64c66d244b 062/146: * swsw.el (swsw-ids): Removed, ELPA Syncer, 2022/05/25