[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swsw a5b25e075f 032/146: Allow setting the scope to the se
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swsw a5b25e075f 032/146: Allow setting the scope to the selected frame |
Date: |
Wed, 25 May 2022 02:59:41 -0400 (EDT) |
branch: elpa/swsw
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."
- [nongnu] elpa/swsw 4a7ea31b37 036/146: * swsw.el (swsw-mode): Bind 'C-x o' to 'swsw-select', (continued)
- [nongnu] elpa/swsw 4a7ea31b37 036/146: * swsw.el (swsw-mode): Bind 'C-x o' to 'swsw-select', ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 63e295f599 025/146: Add a user option to customize the scope of window tracking, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 721d0208f7 026/146: Update the window list after deleting a frame, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 48db8fe39b 021/146: Add a reference implementation for a conditional display function, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 4c84ca310f 016/146: ; Update README to reflect recent changes, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw a816f208e9 005/146: Simplify the format of 'swsw-window-list', ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw f9a901c809 004/146: * swsw.el (swsw-id-chars-base): Remove erroneous quote, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 96809a6cae 019/146: Add the ability to change the way window IDs are displayed, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw c08a9b1e58 024/146: ; Fix a docstring, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw b6277eb31f 037/146: ; Indicate that version 1.1 is still in development in the NEWS file, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw a5b25e075f 032/146: Allow setting the scope to the selected frame,
ELPA Syncer <=
- [nongnu] elpa/swsw 082e03382e 033/146: * swsw.el (swsw-select): Ensure 'swsw-after-select-hook' runs., ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 40f7a25f82 047/146: ; Add license information to the title page of the Info node, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 3a9848deac 042/146: Add an Info node for the package, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw c2c579a3c9 061/146: Construct multi-character IDs without pre-computing all possible IDs, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 7d82ffeef4 076/146: ; Small modifications to the NEWS file, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 4ceacd0330 132/146: Indicate that some functions are for interactive use only, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw eba70478e0 065/146: Update window information after 'swsw-scope' is customized, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 51fcc776bd 081/146: ; Reorganize swsw.el, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 2f7500636d 098/146: ; Add 'swsw' to .gitignore, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw db5cd237a7 125/146: ; Documentation improvements, ELPA Syncer, 2022/05/25