[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/window-commander a5b25e075f 032/170: Allow setting the
From: |
ELPA Syncer |
Subject: |
[elpa] externals/window-commander a5b25e075f 032/170: Allow setting the scope to the selected frame |
Date: |
Wed, 28 Jun 2023 19:00:22 -0400 (EDT) |
branch: externals/window-commander
commit a5b25e075f2bb45a844d39f5bdd084da7b8cf75c
Author: Daniel Semyonov <cmstr@dsemy.com>
Commit: Daniel Semyonov <cmstr@dsemy.com>
Allow setting the scope to the selected frame
* swsw.el (swsw-scope): Add 'current' choice to limit scope to the
current frame.
(swsw--get-scope): New function to return a value suitable for
'window-list-1' and 'walk-windows' based on 'swsw-scope'.
---
swsw.el | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/swsw.el b/swsw.el
index d9bd80990f..a061d60985 100644
--- a/swsw.el
+++ b/swsw.el
@@ -82,12 +82,15 @@
t means consider all windows on all existing frames.
0 (the number zero) means consider all windows on all visible and iconified
frames.
-‘visible’ means consider all windows on all visible frames."
+‘visible’ means consider all windows on all visible frames.
+‘current’ means consider only the currently selected frame."
:group 'swsw
:type '(radio (const :tag "All windows on all frames" t)
(const
:tag "All windows on all visible and iconified frames." 0)
- (const :tag "All windows on all visible frames" 'visible)))
+ (const :tag "All windows on all visible frames" visible)
+ (const
+ :tag "All window on the currently selected frame" current)))
(defvar swsw-display-function 'lighter) ;; Avoid byte-compilation warning.
@@ -125,6 +128,12 @@ If set to `lighter', use the mode line lighter of
`swsw-mode'"
(defvar swsw-window-list nil
"Alist of active active windows and their IDs.")
+(defun swsw--get-scope ()
+ "Return the current scope of `swsw-mode'."
+ (if (eq swsw-scope 'current)
+ (selected-frame)
+ swsw-scope))
+
(defun swsw--get-possible-ids (&rest char-lists)
"Return the Cartesian product of all CHAR-LISTS."
(if char-lists
@@ -137,7 +146,7 @@ If set to `lighter', use the mode line lighter of
`swsw-mode'"
(defun swsw--get-id-length ()
"Return the current length of a window ID."
- (let* ((windows (length (window-list-1 nil nil swsw-scope)))
+ (let* ((windows (length (window-list-1 nil nil (swsw--get-scope))))
(chars (length swsw-id-chars))
(div (/ windows chars)))
;; Check the remainder to avoid returning a longer length than necessary.
@@ -163,7 +172,7 @@ If set to `lighter', use the mode line lighter of
`swsw-mode'"
(push swsw-id-chars char-lists)
(setq acc (1+ acc)))
(apply #'swsw--get-possible-ids char-lists)))
- (walk-windows #'swsw-update-window nil swsw-scope))
+ (walk-windows #'swsw-update-window nil (swsw--get-scope)))
(defun swsw-format-id (window)
"Format an ID string for WINDOW."
- [elpa] externals/window-commander 74124620af 048/170: ; Add brief usage information to the docstring of 'swsw-mode', (continued)
- [elpa] externals/window-commander 74124620af 048/170: ; Add brief usage information to the docstring of 'swsw-mode', ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 5b0f4657cc 052/170: ; Simplify build process, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander f9f64e0559 060/170: * swsw.el (swsw--get-id-length): Return 1 when there is one window tracked, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 64c66d244b 062/170: * swsw.el (swsw-ids): Removed, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander b3f6cee6af 068/170: ; Unify information in the README and commentary, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 5e77d34dfa 054/170: ; Modify installation section of the README file and Info node, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 185861a2e9 010/170: Use a lighter for 'swsw-mode', ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander c08a9b1e58 024/170: ; Fix a docstring, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 5addab5009 027/170: ; Fix installing swsw.el as a package, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 2d2edca2c3 029/170: ; Add 'Usage:' section to the commentary, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander a5b25e075f 032/170: Allow setting the scope to the selected frame,
ELPA Syncer <=
- [elpa] externals/window-commander 2002152fb7 023/170: ; Add .gitignore file, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 5937f8bc6e 043/170: ; Update .gitignore to ignore some build artifacts, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander d5ab98b9db 044/170: ; Bump version to 1.1, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 04ace20d03 063/170: ; Fix indentation and compact structure in some places, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander eba70478e0 065/170: Update window information after 'swsw-scope' is customized, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander d195e574c0 066/170: ; Add latest changes to the news file, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander cf70d1d22c 071/170: ; Make an if statement more readable, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander b3e00165f2 073/170: ; Add latest changes to the NEWS file and indicate that 1.1.2 is WIP, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 522bfb2da0 074/170: ; Add versioning scheme information to the NEWS file, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 3261f323e9 077/170: ; Bump version to 1.1.2, ELPA Syncer, 2023/06/28