emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/window-commander ae9876b2c6 163/170: Rename to Window C


From: ELPA Syncer
Subject: [elpa] externals/window-commander ae9876b2c6 163/170: Rename to Window Commander and simplify project
Date: Wed, 28 Jun 2023 19:00:36 -0400 (EDT)

branch: externals/window-commander
commit ae9876b2c61c5f5aa444bdc1982528c9d2125199
Author: Daniel Semyonov <daniel@dsemy.com>
Commit: Daniel Semyonov <daniel@dsemy.com>

    Rename to Window Commander and simplify project
    
    Note that not all new URLs work yet as of this commit.
    
    * .build.yml:
    * Makefile:
    * config.mk: Remove.
    * .elpaignore: Remove obsolete entries.
    * wincom.el: Rename from swsw.el and remove support for obsolete
    behavior.
    * wincom.text: Rename from swsw.texi.
    (Installation): Remove custom build information.
    (Usage): Expand.
---
 .build.yml               |  11 -
 .elpaignore              |   3 -
 Makefile                 |  48 -----
 NEWS                     |  13 +-
 README                   |  75 +++----
 config.mk                |   6 -
 swsw.el                  | 526 -----------------------------------------------
 wincom.el                | 499 ++++++++++++++++++++++++++++++++++++++++++++
 swsw.texi => wincom.texi | 204 ++++++++----------
 9 files changed, 627 insertions(+), 758 deletions(-)

diff --git a/.build.yml b/.build.yml
deleted file mode 100644
index 8a96e98ccb..0000000000
--- a/.build.yml
+++ /dev/null
@@ -1,11 +0,0 @@
-image: alpine/latest
-packages:
-        - texinfo
-sources:
-        - https://git.sr.ht/~dsemy/swsw
-tasks:
-        - build: |
-                cd swsw
-                make
-artifacts:
-        - swsw/swsw-2.3.tar
diff --git a/.elpaignore b/.elpaignore
index 05db472dcf..8f92569a8a 100644
--- a/.elpaignore
+++ b/.elpaignore
@@ -1,5 +1,2 @@
-.build.yml
 LICENSE
-Makefile
 README
-config.mk
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 34fdfcb8ef..0000000000
--- a/Makefile
+++ /dev/null
@@ -1,48 +0,0 @@
-include config.mk
-
-.PHONY: all help info package clean
-
-.SUFFIXES: .texi .info
-
-all: clean package
-
-help:
-       $(info make info     - generate the info manual)
-       $(info make package  - generate a tar file containing the package)
-       $(info make clean    - remove generated files)
-       @exit
-
-.texi.info:
-       $(MAKEINFO) --no-split $< -o $@
-
-dir: $(PKG).info
-       $(INSTALLINFO) $? $@
-
-info: $(PKG).info dir
-
-$(PKG)-pkg.el: $(PKG).el
-       echo ";;; -*- no-byte-compile: t -*-" > $@
-       sed -n -e 's/;;; $? --- /(define-package "$(PKG)" "$(VERSION)" "/' \
-           -e 's/ -\*- lexical-binding: t -\*-/"/p' \
-           -e "s/;; Package-Requires: /  '/p" \
-           -e 's/, /" "/' -e 's/;; Keywords: /  :keywords ("/p' $? \
-           | sed '$$s/$$/")/' >> $@
-       sed -n -e 's/ </" . "/' -e 's/>/"))/' \
-           -e 's/;; Author: /  :authors (("/p' $? \
-           >> $@
-       sed -n -e 's/ </" . "/' -e 's/>/")/' \
-           -e 's/;; Maintainer: /  :maintainer ("/p' \
-           -e 's/;; URL: /  :url "/p' $? \
-           | sed '$$s/$$/")/' \
-           >> $@
-
-$(PKG)-$(VERSION).tar: $(PKG).info dir $(PKG)-pkg.el *.el LICENSE
-       mkdir $(PKG)-$(VERSION)
-       cp -a $? $(PKG)-$(VERSION)/
-       $(TAR) -cf $@ $(PKG)-$(VERSION)
-       rm -rf $(PKG)-$(VERSION)
-
-package: $(PKG)-$(VERSION).tar
-
-clean:
-       rm -f $(PKG).info dir $(PKG)-pkg.el $(PKG)-$(VERSION).tar
diff --git a/NEWS b/NEWS
index c80629ad52..cd2b70cacd 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,11 @@
-swsw NEWS -- history of user-visible changes. -*- mode: outline -*-
+Window Commander NEWS -- history of user-visible changes. -*- mode: outline -*-
 See the end of the file for an explanation of the versioning scheme.
 
+* 3.0 (wip)
+
+** Rename to Window Commander.
+** Remove functions and vars obsoleted in version 2.x.
+
 * 2.3
 
 ** Rework window commands
@@ -171,9 +176,9 @@ removed completely), and works on older Emacs versions.
 ** Initial version.
 
 * Versioning scheme
-swsw's versioning scheme is inspired by semver (https://semver.org/).
-Each version number is of the form MAJOR.MINOR.PATCH (patch may be
-omitted if 0).
+Window Commander's versioning scheme is inspired by semver
+(https://semver.org/).  Each version number is of the form
+MAJOR.MINOR.PATCH (patch may be omitted if 0).
 The MAJOR version is bumped when a user facing variable or function
 changes in a way that could cause previous user configuration to
 break (where user configuration considered is configuration done
diff --git a/README b/README
index 2afa1cae8a..d1e490135d 100644
--- a/README
+++ b/README
@@ -1,79 +1,64 @@
-swsw - Simple window switching
+Window Commander - Simply execute commands on windows
 
-swsw (simple window switching) provides a minor mode for switching to
+Window Commander provides a minor mode for switching to
 windows or performing actions on them using IDs assigned to them
 automatically.
 
 Installation:
 
-From NonGNU ELPA:
+From GNU ELPA:
 
-M-x package-install RET swsw RET
-
-From the repository:
-
-Clone the repository:
-
-$ git clone 'https://git.sr.ht/~dsemy/swsw'
-
-Build the package:
-
-$ cd swsw
-
-$ make
-
-Install the package:
-
-M-x package-install-file RET /path/to/clone/swsw-VERSION.tar RET
+M-x package-install RET window-commander RET
 
 Usage:
 
-Enable ‘swsw-mode’:
+Enable `wincom-mode':
 
-(swsw-mode)
+(wincom-mode)
 
 For use-package users:
 
-(use-package swsw
+(use-package window-commander
   :config
-  (swsw-mode))
+  (wincom-mode))
 
-When swsw-mode is active:
-- A window ID is displayed using a mode line lighter or a display
-  function (see ‘swsw-display-lighter’).
+When `wincom-mode' is active:
+- A window ID is displayed using a mode line lighter and/or a display
+  function (see `wincom-display-lighter').
 - Window IDs are assigned to all windows on all frames except for
-  the minibuffer (by default, see ‘swsw-scope’).
+  the minibuffer (by default, see `wincom-scope').
+- `other-window' (C-x o by default) is remapped to `wincom-select'.
 
-C-x o ID   switches focus to the window which corresponds to ID.
+C-x o ID       switches focus to the window which corresponds to ID.
 
-C-x o 0 ID deletes the window which corresponds to ID.
+C-x o 0 ID     deletes the window which corresponds to ID.
 
-C-x o 1 ID makes the window which corresponds to ID the sole window of
-           its frame.
+C-x o 1 ID     makes the window which corresponds to ID the sole
+                       window of its frame.
 
-C-x o 2 ID splits the window which corresponds to ID from below.
+C-x o 2 ID     splits the window which corresponds to ID from below.
 
-C-x o 3 ID splits the window which corresponds to ID from the right.
+C-x o 3 ID     splits the window which corresponds to ID from the right.
 
-C-x 0 4 ID displays the buffer of the next command in the window which
-           corresponds to ID.
+C-x 0 4 ID     displays the buffer of the next command in the window
+               which corresponds to ID.
 
-C-x 0 t ID swaps the states of the current window and the window which
-           corresponds to ID.
+C-x 0 t ID     swaps the states of the current window and the window
+               which corresponds to ID.
 
-C-x o m    switches focus to the minibuffer if it's active.
+C-x o m                switches focus to the minibuffer if it's active.
 
-More commands can be added through ‘swsw-command-map’:
+More commands can be added through `wincom-command-map':
 
-(define-key swsw-command-map (kbd "z") #'my-command)
+(define-key wincom-command-map (kbd "z") #'my-command)
 
-You can customize ‘swsw-mode’ using the customize interface:
+You can customize Window Commander further using the customize interface:
 
-M-x customize-group RET swsw RET
+M-x customize-group RET window-commander RET
 
-For more information see the info node (swsw).
+For more information see info node (Window Commander).
 
 Copyright:
 
-Copyright © 2020-2022 Daniel Semyonov <daniel@dsemy.com>
+Copyright © 2023 Free Software Foundation, Inc.
 Licensed under GPLv3 or later.
diff --git a/config.mk b/config.mk
deleted file mode 100644
index b9b6f1a77e..0000000000
--- a/config.mk
+++ /dev/null
@@ -1,6 +0,0 @@
-PKG     = swsw
-VERSION = 2.3
-
-INSTALLINFO = install-info
-MAKEINFO    = makeinfo
-TAR         = tar
diff --git a/swsw.el b/swsw.el
deleted file mode 100644
index 8958230486..0000000000
--- a/swsw.el
+++ /dev/null
@@ -1,526 +0,0 @@
-;;; swsw.el --- Simple window switching -*- lexical-binding: t -*-
-
-;; Copyright (C) 2020-2022 Daniel Semyonov
-
-;; Author: Daniel Semyonov <daniel@dsemy.com>
-;; Maintainer: swsw Mailing List <~dsemy/swsw-devel@lists.sr.ht>
-;; Version: 2.3
-;; Package-Requires: ((emacs "27.1"))
-;; Keywords: convenience
-;; URL: https://dsemy.com/projects/swsw
-
-;; This file is not part of GNU Emacs.
-
-;; swsw is free software; you can redistribute it and/or modify it
-;; under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
-
-;; swsw is distributed in the hope that it will be useful, but WITHOUT
-;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-;; or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-;; License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; swsw provides a minor mode for switching to windows or performing
-;; actions on them using IDs assigned to them automatically.
-;;
-;; Usage:
-;;
-;; Enable `swsw-mode':
-;;
-;; (swsw-mode)
-;;
-;; For use-package users:
-;;
-;; (use-package swsw
-;;   :config
-;;   (swsw-mode))
-;;
-;; When `swsw-mode' is active:
-;; - A window ID is displayed using a mode line lighter or a display
-;;   function (see `swsw-display-lighter').
-;; - Window IDs are assigned to all windows on all frames except for
-;;   the minibuffer (by default, see `swsw-scope').
-;; - `other-window' (C-x o by default) is remapped to `swsw-select'.
-;;
-;; C-x o ID   switches focus to the window which corresponds to ID.
-;;
-;; C-x o 0 ID deletes the window which corresponds to ID.
-;;
-;; C-x o 1 ID makes the window which corresponds to ID the sole window of
-;;            its frame.
-;;
-;; C-x o 2 ID splits the window which corresponds to ID from below.
-;;
-;; C-x o 3 ID splits the window which corresponds to ID from the right.
-;;
-;; C-x 0 4 ID displays the buffer of the next command in the window which
-;;            corresponds to ID.
-;;
-;; C-x 0 t ID swaps the states of the current window and the window which
-;;            corresponds to ID.
-;;
-;; C-x o m    switches focus to the minibuffer if it's active.
-;;
-;; More commands can be added through `swsw-command-map':
-;;
-;; (define-key swsw-command-map (kbd "z") #'my-command)
-;;
-;; You can customize `swsw-mode' using the customize interface:
-;;
-;; M-x customize-group RET swsw RET
-;;
-;; For more information see info node `(swsw)'.
-
-;;; Code:
-
-(eval-when-compile
-  (require 'subr-x)
-  ;; Avoid byte-compilation warnings.
-  (defvar swsw-mode)
-  (defvar swsw-command-map)
-  (declare-function swsw-selected-window-prefix nil))
-
-;;;; Customization:
-
-(defgroup swsw nil
-  "Simple window switching."
-  :link '(custom-manual "(swsw) Top")
-  :group 'convenience
-  :prefix "swsw-")
-
-(defun swsw--set-and-maybe-update (sym val)
-  "Set SYM's variable cell to VAL and call `swsw--update' conditionally."
-  (set-default sym val)
-  (and (boundp swsw-mode) swsw-mode (swsw--update)))
-
-(defcustom swsw-id-chars '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
-  "Base set of characters from which window IDs are constructed.
-This list should contain at least two characters."
-  :link '(info-link "(swsw) Customization")
-  :type '( repeat :validate
-           (lambda (w)
-             (unless (nth 1 (widget-value w))
-               (widget-put
-                w :error
-                "`swsw-id-chars' should contain at least two characters")
-               w))
-           character)
-  :initialize #'custom-initialize-changed
-  :set #'swsw--set-and-maybe-update
-  :risky t
-  :package-version '(swsw . 1.0))
-
-(defcustom swsw-scope t
-  "Scope of all window operations.
-- 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.
-- `current' means consider only the currently selected frame."
-  :link '(info-link "(swsw) Customization")
-  :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 the currently selected frame"
-                 current))
-  :initialize #'custom-initialize-changed
-  :set #'swsw--set-and-maybe-update
-  :risky t
-  :package-version '(swsw . 1.1))
-
-(defcustom swsw-minimum 3
-  "Minimum number of tracked windows for which interactive selection occurs."
-  :link '(info-link "(swsw) Window Commands")
-  :type 'integer
-  :risky t
-  :package-version '(swsw . 2.3))
-
-(define-obsolete-variable-alias 'swsw-display-function
-  'swsw-display-lighter "version 2.2 of the swsw package"
-  "Function used to display the ID of each window.
-This function is called with t as the sole argument when enabling
-simple window switching, and with nil as the sole argument when
-disabling it.")
-
-(defcustom swsw-display-lighter t
-  "Whether or not to show a mode line lighter.
-- non-nil means show a mode line lighter.
-- nil means don't show a mode line lighter.
-
-This variable can also accept a \"display function\" for backwards
-compatibility (see `swsw-display-function')."
-  :link '(info-link "(swsw) Display functions")
-  :type '(radio (const :tag "Show mode line lighter" t)
-                (const :tag "Don't show mode line lighter" nil))
-  :set (lambda (sym fun)
-         (and (boundp sym) (functionp (symbol-value sym))
-              (funcall (symbol-value sym) nil))
-         (set-default sym fun)
-         (and (boundp swsw-mode) (functionp fun)
-              (funcall fun swsw-mode)))
-  :package-version '(swsw . 2.2))
-
-(defcustom swsw-mode-hook nil
-  "Hook run when enabling or disabling simple window switching."
-  :link '(info-link "(swsw) Display functions")
-  :type 'hook
-  :options '(swsw-mode-line-display-function
-             swsw-mode-line-conditional-display-function)
-  :initialize #'custom-initialize-changed
-  :set (lambda (sym hooks)
-         (let ((swsw-mode nil))
-           (when (boundp sym) (run-hooks sym)))
-         (set-default sym hooks)
-         (run-hooks sym))
-  :package-version '(swsw . 1.0))
-
-(defcustom swsw-id-format " <%s>"
-  "Format string for the window ID.
-%s is replaced with a representation of the window's ID."
-  :link '(info-link "(swsw) Customization")
-  :type 'string
-  :package-version '(swsw . 1.0))
-
-;;;; Window tracking:
-
-(defvar swsw--id-counter nil
-  "Counter which determines the next possible ID.")
-(put 'swsw--id-counter 'risky-local-variable t)
-
-(defvar swsw--id-map (make-sparse-keymap)
-  "Key map for window ID selection.")
-
-(defvar swsw-window-count 0
-  "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)
-      (selected-frame)
-    swsw-scope))
-
-(defun swsw--get-id-length ()
-  "Return the current length of a window ID."
-  (if-let ((windows (length (window-list-1 nil nil (swsw--get-scope))))
-           ((= windows 1)))
-      1 ; If there is only one window, return 1.
-    (ceiling (log windows (length swsw-id-chars)))))
-
-(defun swsw--next-id ()
-  "Get the next available ID."
-  (let ((len (length swsw-id-chars)) (adv-flag t) id)
-    (setq swsw--id-counter
-          ;; Translate the current value of the counter to the
-          ;; corresponding ID.
-          (mapcar (lambda (elt)
-                    (push (nth elt swsw-id-chars) id)
-                    ;; Advance `swsw--id-counter'.
-                    (when adv-flag
-                      (if (= len (setq elt (1+ elt)))
-                          (setq elt 0)
-                        (setq adv-flag nil)))
-                    elt)
-                  swsw--id-counter))
-    id))
-
-(defun swsw--update-window (window)
-  "Update information for WINDOW."
-  (when-let ((id (if (window-minibuffer-p window)
-                     (progn
-                       (setq swsw-window-count (1+ swsw-window-count))
-                       nil)
-                   (swsw--next-id))))
-    ;; Create a key sequence from the ID, which corresponds to a
-    ;; command which calls the last command (with the corresponding
-    ;; window as the sole argument).
-    ;; This allows controlling which command is invoked when
-    ;; choosing an ID by setting `this-command' in a command which
-    ;; sets the transient map to `swsw--id-map'.
-    (define-key swsw--id-map (apply #'vector id)
-                `(lambda ()
-                   (interactive)
-                   (funcall last-command ,window)))
-    (set-window-parameter window 'swsw-id id)
-    (setq swsw-window-count (1+ swsw-window-count))))
-
-;; This is a separate function only to prevent running `swsw--update'
-;; on any window state change.
-(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--current-frame (selected-frame))
-  ;; Clear and resize `swsw--id-counter' according to the ID length.
-  ;; `swsw--id-counter' is treated as a base-N number where N is the
-  ;; length of `swsw-id-chars' and each digit M represents the Mth
-  ;; char in `swsw-id-chars'.
-  (dotimes (_var (swsw--get-id-length))
-    (push 0 swsw--id-counter))
-  (walk-windows #'swsw--update-window nil (swsw--get-scope)))
-
-;;;; Display functions:
-
-(defun swsw-format-id (window)
-  "Format an ID string for WINDOW."
-  (format-spec
-   swsw-id-format
-   `((?s . ,(apply #'string (window-parameter window 'swsw-id))))))
-
-(defun swsw--mode-line-display ()
-  "Display window IDs at the beginning of the mode line."
-  (setq-default mode-line-format
-                `((swsw-mode
-                   (:eval (swsw-format-id (selected-window))))
-                  ,@(assq-delete-all
-                     'swsw-mode
-                     (default-value 'mode-line-format))))
-  (force-mode-line-update t))
-
-(defun swsw--mode-line-hide ()
-  "Remove window IDs from the beginning of the mode line."
-  (setq-default mode-line-format
-                (assq-delete-all
-                 'swsw-mode
-                 (default-value 'mode-line-format)))
-  (force-mode-line-update t))
-
-(defun swsw-mode-line-display-function (&optional switch)
-  "Display window IDs at the beginning of the mode line.
-Display window IDs if simple window switching is enabled, and disable
-displaying window IDs if simple window switching is disabled.
-This display function respects `swsw-id-format'.
-
-It is also possible to supply a single SWITCH argument, which will
-override the value of `swsw-mode';
-this form is obsolete since version 2.2 of the swsw package."
-  (declare (advertised-calling-convention nil "2.2"))
-  (if (or switch swsw-mode)
-      (swsw--mode-line-display)
-    (swsw--mode-line-hide)))
-
-(defun swsw-mode-line-conditional-display-function (&optional switch)
-  "Display window IDs at the beginning of the mode line during window 
selection.
-Add a hook to `swsw-before-command-hook' which displays window IDs on
-the mode line and add a hook to `swsw-after-command-hook' which hides
-window IDs from the mode line if simple window switching is enabled,
-and remove those hooks if simple window switching is disabled.
-This display function respects `swsw-id-format'.
-
-It is also possible to supply a single SWITCH argument, which will
-override the value of `swsw-mode';
-this form is obsolete since version 2.2 of the swsw package."
-  (declare (advertised-calling-convention nil "2.2"))
-  (if (or switch swsw-mode)
-      (progn
-        (add-hook 'swsw-before-command-hook #'swsw--mode-line-display)
-        (add-hook 'swsw-after-command-hook #'swsw--mode-line-hide))
-    (remove-hook 'swsw-before-command-hook #'swsw--mode-line-display)
-    (remove-hook 'swsw-after-command-hook #'swsw--mode-line-hide)))
-
-;;;; Window commands:
-
-(defun swsw-run-window-command (fun)
-  "Run FUN as a window command.
-Run `swsw-before-command-hook', set `this-command' to FUN and set a
-transient map for ID selection which runs `swsw-after-command-hook' on
-exit."
-  (run-hooks 'swsw-before-command-hook)
-  (setq this-command fun)
-  (set-transient-map swsw--id-map
-                     (lambda ()
-                       (run-hooks 'swsw-after-command-hook))))
-
-(defmacro swsw-define-window-command (name args &rest body)
-  "Define NAME as a window command with DOCSTRING as its documentation string.
-
-Inside BODY, WINDOW and PREFIX (symbols) are bound to the selected
-window and the raw prefix argument, respectively.
-If PREFIX is omitted or nil, the resulting command will not accept a
-prefix argument.
-
-If MINIBUFFER is non-nil, allow the minibuffer to be selected by
-`next-window' (when there are less than `swsw-minimum' tracked windows).
-
-For more information, see info node `(swsw) Window Commands'.
-
-\(fn NAME (WINDOW [PREFIX] [MINIBUFFER]) [DOCSTRING] BODY...)"
-  (declare (debug (&define [&name symbolp] listp [&optional stringp] def-body))
-           (doc-string 3) (indent defun))
-  (let* ((docstring (car body)) (window (car args))
-         (prefix (cadr args)) (minibuffer (caddr args)))
-    `(defun ,name ,(and prefix `(,prefix))
-       ,(when (stringp docstring) (format "%s
-
-If less than `swsw-minimum' windows have been assigned an ID,
-use the window returned by `next-window' (according to the
-value of `swsw-scope'%s).
-Otherwise, either a window is selected using its ID or a separate
-window command is chosen.
-
-  This is a window command, intended to be used only when simple
-  window switching is enabled; for more information, see info node
-  `(swsw) Window Commands'.
-" docstring (if minibuffer "" ", excluding the minibuffer")))
-       (declare (modes swsw-mode)
-                (interactive-only t))
-       (interactive ,(and prefix "P"))
-       (if-let ((f (lambda (,window)
-                     ,@body))
-                ((>= swsw-window-count swsw-minimum)))
-           (swsw-run-window-command f)
-         (funcall f (next-window nil (unless ,minibuffer 'exclude)
-                                 (swsw--get-scope)))))))
-
-(swsw-define-window-command swsw-select (window nil t)
-  "Select a window."
-  (select-window window))
-
-(swsw-define-window-command swsw-delete (window)
-  "Delete a window."
-  (delete-window window))
-
-(swsw-define-window-command swsw-delete-other (window)
-  "Make a window the sole window of its frame."
-  (delete-other-windows window))
-
-(swsw-define-window-command swsw-split-window-below (window size)
-  "Split a window from below.
-If optional argument SIZE is omitted or nil, both windows get the same
-height, or close to it.  If SIZE is positive, the upper window gets
-SIZE lines.  If SIZE is negative, the lower window gets -SIZE lines."
-  (split-window-below (and size (prefix-numeric-value size)) window))
-
-(swsw-define-window-command swsw-split-window-right (window size)
-  "Split a window from the right.
-If optional argument SIZE is omitted or nil, both windows get the same
-width, or close to it.  If SIZE is positive, the left-hand window gets
-SIZE columns.  If SIZE is negative, the right-hand window gets -SIZE
-columns.  Here, SIZE includes the width of the window’s scroll bar; if
-there are no scroll bars, it includes the width of the divider column
-to the window’s right, if any."
-  (split-window-right (and size (prefix-numeric-value size)) window))
-
-(defun swsw-display-buffer-selected-window (buffer alist)
-  "Display BUFFER in the selected (through swsw) window.
-ALIST is an association list of action symbols and values.  See
-Info node `(elisp) Buffer Display Action Alists' for details of
-such alists.
-
-The function fails if ALIST has no `window' element or its value isn't a
-live window, or if it is a minibuffer window or is dedicated to another
-buffer; in that case return nil.
-Otherwise, return the value of the `window' element.
-
-This is an action function for buffer display, see Info
-node ‘(elisp) Buffer Display Action Functions’.  It should be
-called only by ‘display-buffer’ or a function directly or
-indirectly called by the latter."
-  (let ((window (cdr (assq 'window alist))))
-    (unless (or (not (windowp window))
-                (window-minibuffer-p window)
-                (window-dedicated-p window))
-      (window--display-buffer buffer window 'reuse alist))))
-
-(when (fboundp 'display-buffer-override-next-command)
-  (swsw-define-window-command swsw-selected-window-prefix (window)
-    "Display the buffer of the next command in a window."
-    (display-buffer-override-next-command
-     (lambda (buffer alist)
-       (setq alist (append `((window . ,window)) alist))
-       (cons (swsw-display-buffer-selected-window buffer alist) 'reuse))
-     nil (format "[swsw-window-%s]" (window-parameter window 'swsw-id)))
-    (message "Display next command buffer in the selected window...")))
-
-(swsw-define-window-command swsw-swap (window)
-  "Swap the states of a window and the currently selected window."
-  (window-swap-states nil window)
-  (and (eq (current-buffer) (window-buffer window)) (swsw--update)))
-
-(defun swsw-select-minibuffer ()
-  "Select the active minibuffer window (if it exists)."
-  (declare (modes swsw-mode))
-  (interactive)
-  (select-window (or (active-minibuffer-window)
-                     (user-error "There is no active minibuffer window"))))
-
-(defvar swsw-command-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map [?o] #'swsw-select)
-    (define-key map [?0] #'swsw-delete)
-    (define-key map [?1] #'swsw-delete-other)
-    (define-key map [?2] #'swsw-split-window-below)
-    (define-key map [?3] #'swsw-split-window-right)
-    (when (fboundp 'display-buffer-override-next-command)
-      (define-key map [?4] #'swsw-selected-window-prefix))
-    (define-key map [?t] #'swsw-swap)
-    (define-key map [?m] #'swsw-select-minibuffer)
-    map)
-  "Key map for window commands.
-This key map is set as the parent of `swsw--id-map' during ID
-selection.")
-
-;;;; swsw mode:
-
-;;;###autoload
-(define-minor-mode swsw-mode
-  "Toggle swsw mode.
-
-When swsw mode is enabled, window IDs are shown as mode line
-lighters of the form \"<ID>\" (by default), and `other-window' is remapped to
-`swsw-select' (a command used to select windows according to their ID).
-
-The following key bindings are available after starting window
-selection:
-
-\\{swsw-command-map}"
-  :global t
-  :lighter (:eval (and swsw-display-lighter
-                       (not (functionp swsw-display-lighter))
-                       (swsw-format-id (selected-window))))
-  :keymap (let ((map (make-sparse-keymap)))
-            (define-key map [remap other-window] #'swsw-select)
-            map)
-  (if swsw-mode
-      (progn
-        (swsw--update)
-        (when (functionp swsw-display-lighter)
-          (funcall swsw-display-lighter))
-        (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))
-    (when (functionp swsw-display-lighter)
-      (funcall swsw-display-lighter))
-    (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)))
-
-(provide 'swsw)
-
-;;; swsw.el ends here
diff --git a/wincom.el b/wincom.el
new file mode 100644
index 0000000000..8a9983dee4
--- /dev/null
+++ b/wincom.el
@@ -0,0 +1,499 @@
+;;; wincom.el --- Simply execute commands on windows -*- lexical-binding: t -*-
+
+;; Copyright (C) 2023 Free Software Foundation, Inc.
+
+;; Author: Daniel Semyonov <daniel@dsemy.com>
+;; Maintainer: Daniel Semyonov <daniel@dsemy.com>
+;; Version: 2.3
+;; Package-Requires: ((emacs "27.1"))
+;; Keywords: convenience
+;; URL: https://dsemy.com/projects/window-commander
+
+;; This file is not part of GNU Emacs.
+
+;; Window Commander is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 3, or (at
+;; your option) any later version.
+
+;; Window Commander is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Window Commander provides a minor mode for switching to windows or
+;; performing actions on them using IDs assigned to them automatically.
+;;
+;; Usage:
+;;
+;; Enable `wincom-mode':
+;;
+;; (wincom-mode)
+;;
+;; For use-package users:
+;;
+;; (use-package window-commander
+;;   :config
+;;   (wincom-mode))
+;;
+;; When `wincom-mode' is active:
+;; - A window ID is displayed using a mode line lighter and/or a display
+;;   function (see `wincom-display-lighter').
+;; - Window IDs are assigned to all windows on all frames except for
+;;   the minibuffer (by default, see `wincom-scope').
+;; - `other-window' (C-x o by default) is remapped to `wincom-select'.
+;;
+;; C-x o ID    switches focus to the window which corresponds to ID.
+;;
+;; C-x o 0 ID  deletes the window which corresponds to ID.
+;;
+;; C-x o 1 ID  makes the window which corresponds to ID the sole
+;;             window of its frame.
+;;
+;; C-x o 2 ID  splits the window which corresponds to ID from below.
+;;
+;; C-x o 3 ID  splits the window which corresponds to ID from the right.
+;;
+;; C-x 0 4 ID  displays the buffer of the next command in the window
+;;             which corresponds to ID.
+;;
+;; C-x 0 t ID  swaps the states of the current window and the window
+;;             which corresponds to ID.
+;;
+;; C-x o m     switches focus to the minibuffer if it's active.
+;;
+;; More commands can be added through `wincom-command-map':
+;;
+;; (define-key wincom-command-map (kbd "z") #'my-command)
+;;
+;; You can customize Window Commander further using the customize interface:
+;;
+;; M-x customize-group RET window-commander RET
+;;
+;; For more information see info node `(Window Commander)'.
+
+;;; Code:
+
+(eval-when-compile
+  (require 'subr-x)
+  ;; Avoid byte-compilation warnings.
+  (defvar wincom-mode)
+  (defvar wincom-command-map)
+  (declare-function wincom-selected-window-prefix nil))
+
+;;;; Customization:
+
+(defgroup window-commander nil
+  "Window Commander."
+  :link '(custom-manual "(Window Commander) Top")
+  :group 'convenience
+  :prefix "wincom-")
+
+(defun wincom--set-and-maybe-update (sym val)
+  "Set SYM's variable cell to VAL and call `wincom--update' conditionally."
+  (set-default sym val)
+  (and (boundp wincom-mode) wincom-mode (wincom--update)))
+
+(defcustom wincom-id-chars '(?a ?s ?d ?f ?g ?h ?j ?k ?l)
+  "Base set of characters from which window IDs are constructed.
+This list should contain at least two characters."
+  :link '(info-link "(Window Commander) Customization")
+  :type '( repeat :validate
+           (lambda (w)
+             (unless (nth 1 (widget-value w))
+               (widget-put
+                w :error
+                "`wincom-id-chars' should contain at least two characters")
+               w))
+           character)
+  :initialize #'custom-initialize-changed
+  :set #'wincom--set-and-maybe-update
+  :risky t
+  :package-version '(swsw . 1.0))
+
+(defcustom wincom-scope t
+  "Scope of all window operations.
+- 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.
+- `current' means consider only the currently selected frame."
+  :link '(info-link "(Window Commander) Customization")
+  :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 the currently selected frame"
+                 current))
+  :initialize #'custom-initialize-changed
+  :set #'wincom--set-and-maybe-update
+  :risky t
+  :package-version '(swsw . 1.1))
+
+(defcustom wincom-minimum 3
+  "Minimum number of tracked windows for which interactive selection occurs."
+  :link '(info-link "(Window Commander) Window Commands")
+  :type 'integer
+  :risky t
+  :package-version '(swsw . 2.3))
+
+(defcustom wincom-display-lighter t
+  "Whether or not to show a mode line lighter.
+- non-nil means show a mode line lighter.
+- nil means don't show a mode line lighter."
+  :link '(info-link "(Window Commander) Display functions")
+  :type '(radio (const :tag "Show mode line lighter" t)
+                (const :tag "Don't show mode line lighter" nil))
+  :package-version '(swsw . 2.2))
+
+(defcustom wincom-mode-hook nil
+  "Hook run when enabling or disabling Window Commander mode."
+  :link '(info-link "(Window Commander) Display functions")
+  :type 'hook
+  :options '(wincom-mode-line-display-function
+             wincom-mode-line-conditional-display-function)
+  :initialize #'custom-initialize-changed
+  :set (lambda (sym hooks)
+         (let ((wincom-mode nil))
+           (when (boundp sym) (run-hooks sym)))
+         (set-default sym hooks)
+         (run-hooks sym))
+  :package-version '(swsw . 1.0))
+
+(defcustom wincom-id-format " <%s>"
+  "Format string for the window ID.
+%s is replaced with a representation of the window's ID."
+  :link '(info-link "(Window Commander) Customization")
+  :type 'string
+  :package-version '(swsw . 1.0))
+
+;;;; Window tracking:
+
+(defvar wincom--id-counter nil
+  "Counter which determines the next possible ID.")
+(put 'wincom--id-counter 'risky-local-variable t)
+
+(defvar wincom--id-map (make-sparse-keymap)
+  "Key map for window ID selection.")
+
+(defvar wincom-window-count 0
+  "Amount of windows that have been assigned an ID.")
+(put 'wincom-window-count 'risky-local-variable t)
+
+(defvar wincom--current-frame nil
+  "Current frame (set by `wincom--update'), used to detect frame changes.")
+(put 'wincom--current-frame 'risky-local-variable t)
+
+(defun wincom--get-scope ()
+  "Return the current scope in which windows should be tracked."
+  (if (eq wincom-scope 'current)
+      (selected-frame)
+    wincom-scope))
+
+(defun wincom--get-id-length ()
+  "Return the current length of a window ID."
+  (if-let ((windows (length (window-list-1 nil nil (wincom--get-scope))))
+           ((= windows 1)))
+      1 ; If there is only one window, return 1.
+    (ceiling (log windows (length wincom-id-chars)))))
+
+(defun wincom--next-id ()
+  "Get the next available ID."
+  (let ((len (length wincom-id-chars)) (adv-flag t) id)
+    (setq wincom--id-counter
+          ;; Translate the current value of the counter to the
+          ;; corresponding ID.
+          (mapcar (lambda (elt)
+                    (push (nth elt wincom-id-chars) id)
+                    ;; Advance `wincom--id-counter'.
+                    (when adv-flag
+                      (if (= len (setq elt (1+ elt)))
+                          (setq elt 0)
+                        (setq adv-flag nil)))
+                    elt)
+                  wincom--id-counter))
+    id))
+
+(defun wincom--update-window (window)
+  "Update information for WINDOW."
+  (when-let ((id (if (window-minibuffer-p window)
+                     (progn
+                       (setq wincom-window-count (1+ wincom-window-count))
+                       nil)
+                   (wincom--next-id))))
+    ;; Create a key sequence from the ID, which corresponds to a
+    ;; command which calls the last command (with the corresponding
+    ;; window as the sole argument).
+    ;; This allows controlling which command is invoked when
+    ;; choosing an ID by setting `this-command' in a command which
+    ;; sets the transient map to `wincom--id-map'.
+    (define-key wincom--id-map (apply #'vector id)
+                `(lambda ()
+                   (interactive)
+                   (funcall last-command ,window)))
+    (set-window-parameter window 'wincom-id id)
+    (setq wincom-window-count (1+ wincom-window-count))))
+
+;; This is a separate function only to prevent running `wincom--update'
+;; on any window state change.
+(defun wincom--update-frame ()
+  "Run `wincom--update' if the current frame isn't `wincom--current-frame'.
+This check is skipped (and this function does nothing) if `wincom-scope'
+is t."
+  (unless (or (eq (wincom--get-scope) t)
+              (eq wincom--current-frame (selected-frame)))
+    (wincom--update)))
+
+(defun wincom--update (&optional _frame)
+  "Update information for all windows."
+  (setq wincom--id-map (make-sparse-keymap))
+  (set-keymap-parent wincom--id-map wincom-command-map)
+  (setq wincom--id-counter nil
+        wincom-window-count 0
+        wincom--current-frame (selected-frame))
+  ;; Clear and resize `wincom--id-counter' according to the ID length.
+  ;; `wincom--id-counter' is treated as a base-N number where N is the
+  ;; length of `wincom-id-chars' and each digit M represents the Mth
+  ;; char in `wincom-id-chars'.
+  (dotimes (_var (wincom--get-id-length))
+    (push 0 wincom--id-counter))
+  (walk-windows #'wincom--update-window nil (wincom--get-scope)))
+
+;;;; Display functions:
+
+(defun wincom-format-id (window)
+  "Format an ID string for WINDOW."
+  (format-spec
+   wincom-id-format
+   `((?s . ,(apply #'string (window-parameter window 'wincom-id))))))
+
+(defun wincom--display-mode-line-show ()
+  "Display window IDs at the beginning of the mode line."
+  (setq-default mode-line-format
+                `((wincom-mode
+                   (:eval (wincom-format-id (selected-window))))
+                  ,@(assq-delete-all
+                     'wincom-mode
+                     (default-value 'mode-line-format))))
+  (force-mode-line-update t))
+
+(defun wincom--display-mode-line-hide ()
+  "Remove window IDs from the beginning of the mode line."
+  (setq-default mode-line-format
+                (assq-delete-all
+                 'wincom-mode
+                 (default-value 'mode-line-format)))
+  (force-mode-line-update t))
+
+(defun wincom-display-mode-line ()
+  "Display window IDs at the beginning of the mode line.
+Display window IDs if Window Commander mode is enabled, and disable
+displaying window IDs if Window Commander Mode is disabled.
+This display function respects `wincom-id-format'."
+  (if wincom-mode (wincom--display-mode-line-show)
+    (wincom--display-mode-line-hide)))
+
+(defun wincom-display-mode-line-conditional ()
+  "Display window IDs at the beginning of the mode line during window 
selection.
+Add a hook to `wincom-before-command-hook' which displays window IDs on
+the mode line and add a hook to `wincom-after-command-hook' which hides
+window IDs from the mode line if Window Commander mode is enabled,
+and remove those hooks if Window Commander mode is disabled.
+This display function respects `wincom-id-format'."
+  (if wincom-mode
+      (progn
+        (add-hook 'wincom-before-command-hook #'wincom--display-mode-line-show)
+        (add-hook 'wincom-after-command-hook #'wincom--display-mode-line-hide))
+    (remove-hook 'wincom-before-command-hook #'wincom--display-mode-line-show)
+    (remove-hook 'wincom-after-command-hook #'wincom--display-mode-line-show)))
+
+;;;; Window commands:
+
+(defun wincom-run-window-command (fun)
+  "Run FUN as a window command.
+Run `wincom-before-command-hook', set `this-command' to FUN and set a
+transient map for ID selection which runs `wincom-after-command-hook' on
+exit."
+  (run-hooks 'wincom-before-command-hook)
+  (setq this-command fun)
+  (set-transient-map wincom--id-map
+                     (lambda ()
+                       (run-hooks 'wincom-after-command-hook))))
+
+(defmacro wincom-define-window-command (name args &rest body)
+  "Define NAME as a window command with DOCSTRING as its documentation string.
+
+Inside BODY, WINDOW and PREFIX (symbols) are bound to the selected
+window and the raw prefix argument, respectively.
+If PREFIX is omitted or nil, the resulting command will not accept a
+prefix argument.
+
+If MINIBUFFER is non-nil, allow the minibuffer to be selected by
+`next-window' (when there are less than `wincom-minimum' tracked windows).
+
+For more information, see info node `(Window Commander) Window Commands'.
+
+\(fn NAME (WINDOW [PREFIX] [MINIBUFFER]) [DOCSTRING] BODY...)"
+  (declare (debug (&define [&name symbolp] listp [&optional stringp] def-body))
+           (doc-string 3) (indent defun))
+  (let* ((docstring (car body)) (window (car args))
+         (prefix (cadr args)) (minibuffer (caddr args)))
+    `(defun ,name ,(and prefix `(,prefix))
+       ,(when (stringp docstring) (format "%s
+
+If less than `wincom-minimum' windows have been assigned an ID,
+use the window returned by `next-window' (according to the
+value of `wincom-scope'%s).
+Otherwise, either a window is selected using its ID or a separate
+window command is chosen.
+
+  This is a window command, intended to be used only when Window
+  Commander mode is enabled; for more information, see info node
+  `(Window Commander) Window Commands'.
+" docstring (if minibuffer "" ", excluding the minibuffer")))
+       (declare (modes wincom-mode)
+                (interactive-only t))
+       (interactive ,(and prefix "P"))
+       (if-let ((f (lambda (,window)
+                     ,@body))
+                ((>= wincom-window-count wincom-minimum)))
+           (wincom-run-window-command f)
+         (funcall f (next-window nil (unless ,minibuffer 'exclude)
+                                 (wincom--get-scope)))))))
+
+(wincom-define-window-command wincom-select (window nil t)
+  "Select a window."
+  (select-window window))
+
+(wincom-define-window-command wincom-delete (window)
+  "Delete a window."
+  (delete-window window))
+
+(wincom-define-window-command wincom-delete-other (window)
+  "Make a window the sole window of its frame."
+  (delete-other-windows window))
+
+(wincom-define-window-command wincom-split-window-below (window size)
+  "Split a window from below.
+If optional argument SIZE is omitted or nil, both windows get the same
+height, or close to it.  If SIZE is positive, the upper window gets
+SIZE lines.  If SIZE is negative, the lower window gets -SIZE lines."
+  (split-window-below (and size (prefix-numeric-value size)) window))
+
+(wincom-define-window-command wincom-split-window-right (window size)
+  "Split a window from the right.
+If optional argument SIZE is omitted or nil, both windows get the same
+width, or close to it.  If SIZE is positive, the left-hand window gets
+SIZE columns.  If SIZE is negative, the right-hand window gets -SIZE
+columns.  Here, SIZE includes the width of the window’s scroll bar; if
+there are no scroll bars, it includes the width of the divider column
+to the window’s right, if any."
+  (split-window-right (and size (prefix-numeric-value size)) window))
+
+(defun wincom-display-buffer-selected-window (buffer alist)
+  "Display BUFFER in the selected (through wincom) window.
+ALIST is an association list of action symbols and values.  See
+Info node `(elisp) Buffer Display Action Alists' for details of
+such alists.
+
+The function fails if ALIST has no `window' element or its value isn't a
+live window, or if it is a minibuffer window or is dedicated to another
+buffer; in that case return nil.
+Otherwise, return the value of the `window' element.
+
+This is an action function for buffer display, see Info
+node ‘(elisp) Buffer Display Action Functions’.  It should be
+called only by ‘display-buffer’ or a function directly or
+indirectly called by the latter."
+  (let ((window (cdr (assq 'window alist))))
+    (unless (or (not (windowp window))
+                (window-minibuffer-p window)
+                (window-dedicated-p window))
+      (window--display-buffer buffer window 'reuse alist))))
+
+(when (fboundp 'display-buffer-override-next-command)
+  (wincom-define-window-command wincom-selected-window-prefix (window)
+    "Display the buffer of the next command in a window."
+    (display-buffer-override-next-command
+     (lambda (buffer alist)
+       (setq alist (append `((window . ,window)) alist))
+       (cons (wincom-display-buffer-selected-window buffer alist) 'reuse))
+     nil (format "[window-commander-%s]" (window-parameter window 'wincom-id)))
+    (message "Display next command buffer in the selected window...")))
+
+(wincom-define-window-command wincom-swap (window)
+  "Swap the states of a window and the currently selected window."
+  (window-swap-states nil window)
+  (and (eq (current-buffer) (window-buffer window)) (wincom--update)))
+
+(defun wincom-select-minibuffer ()
+  "Select the active minibuffer window (if it exists)."
+  (declare (modes wincom-mode))
+  (interactive)
+  (select-window (or (active-minibuffer-window)
+                     (user-error "There is no active minibuffer window"))))
+
+(defvar wincom-command-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [?o] #'wincom-select)
+    (define-key map [?0] #'wincom-delete)
+    (define-key map [?1] #'wincom-delete-other)
+    (define-key map [?2] #'wincom-split-window-below)
+    (define-key map [?3] #'wincom-split-window-right)
+    (when (fboundp 'display-buffer-override-next-command)
+      (define-key map [?4] #'wincom-selected-window-prefix))
+    (define-key map [?t] #'wincom-swap)
+    (define-key map [?m] #'wincom-select-minibuffer)
+    map)
+  "Key map for window commands.
+This key map is set as the parent of `wincom--id-map' during ID
+selection.")
+
+;;;; wincom mode:
+
+;;;###autoload
+(define-minor-mode wincom-mode
+  "Toggle Window Commander mode.
+
+When Window Commander mode is enabled, window IDs are shown as mode line
+lighters of the form \"<ID>\" (by default), and `other-window' is remapped to
+`wincom-select' (a command used to select windows according to their ID).
+
+The following key bindings are available after starting window
+selection:
+
+\\{wincom-command-map}"
+  :global t
+  :lighter (:eval (and wincom-display-lighter
+                       (not (functionp wincom-display-lighter))
+                       (wincom-format-id (selected-window))))
+  :keymap (let ((map (make-sparse-keymap)))
+            (define-key map [remap other-window] #'wincom-select)
+            map)
+  (if wincom-mode
+      (progn
+        (wincom--update)
+        (when (functionp wincom-display-lighter)
+          (funcall wincom-display-lighter))
+        (add-hook 'window-configuration-change-hook #'wincom--update)
+        (add-hook 'window-state-change-hook #'wincom--update-frame)
+        (add-hook 'minibuffer-setup-hook #'wincom--update)
+        (add-hook 'minibuffer-exit-hook #'wincom--update)
+        (add-hook 'after-delete-frame-functions #'wincom--update))
+    (when (functionp wincom-display-lighter)
+      (funcall wincom-display-lighter))
+    (remove-hook 'window-configuration-change-hook #'wincom--update)
+    (remove-hook 'window-state-change-hook #'wincom--update-frame)
+    (remove-hook 'minibuffer-setup-hook #'wincom--update)
+    (remove-hook 'minibuffer-exit-hook #'wincom--update)
+    (remove-hook 'after-delete-frame-functions #'wincom--update)))
+
+(provide 'wincom)
+
+;;; wincom.el ends here
diff --git a/swsw.texi b/wincom.texi
similarity index 59%
rename from swsw.texi
rename to wincom.texi
index 3e89ff1352..0f196b9163 100644
--- a/swsw.texi
+++ b/wincom.texi
@@ -1,12 +1,12 @@
 \input texinfo
-@setfilename swsw.info
-@settitle swsw User Manual
+@setfilename wincom.info
+@settitle Window Commander User Manual
 @documentencoding UTF-8
 @documentlanguage en
 
 @copying
 @quotation
-Copyright @copyright{} 2020-2022 Daniel Semyonov
+Copyright @copyright{} 2023 Free Software Foundation, Inc.
 
 You can redistribute this document and/or modify it under the terms
 of the GNU General Public License as published by the Free Software
@@ -23,11 +23,11 @@ General Public License for more details.
 
 @dircategory Emacs
 @direntry
-* swsw: (swsw). Simple window switching.
+* Window Commander: (Window Commander). Simply execute commands on windows.
 @end direntry
 
 @titlepage
-@title swsw User Manual
+@title Window Commander User Manual
 @subtitle for version 2.3.
 @author Daniel Semyonov
 @page
@@ -39,13 +39,13 @@ General Public License for more details.
 
 @ifnottex
 @node Top
-@top swsw User Manual
+@top Window Commander User Manual
 
-swsw provides a minor mode for switching to windows or performing
+Window Commander provides a minor mode for switching to windows or performing
 actions on them using IDs assigned to them automatically.
 
 @noindent
-This manual is for swsw version 2.3.
+This manual is for Window Commander version 2.3.
 
 @insertcopying
 @end ifnottex
@@ -65,9 +65,6 @@ This manual is for swsw version 2.3.
 
 Installation
 
-* Installing a release::
-* Installing from the Git repository::
-
 Customization
 
 * ID display::
@@ -79,7 +76,7 @@ Customization
 @node Introduction
 @chapter Introduction
 
-swsw provides a minor mode for switching to windows or performing
+Window Commander provides a minor mode for switching to windows or performing
 actions on them using IDs assigned to them automatically. The
 implementation is simple and extensible, providing various advanced
 customization features for users, while keeping the code base small
@@ -88,111 +85,88 @@ and easy to hack on.
 @node Installation
 @chapter Installation
 
-swsw can be installed from NonGNU ELPA:
+Window Commander can be installed from GNU ELPA:
 
 @table @asis
 @item @kbd{M-x package-install RET swsw RET}
 @end table
 
-@menu
-* Installing a release::
-* Installing from the Git repository::
-@end menu
-
-@node Installing a release
-@section Installing a release
-
-Simply download a release (from <https://dsemy.com/projects/swsw>), and install
-it:
-
-@table @asis
-@item @kbd{M-x package-install-file RET /path/to/download/swsw-VERSION.tar RET}
-@end table
-
-@node Installing from the Git repository
-@section Installing from the Git repository
-
-Clone the repository and build the package archive:
-
-@example
-$ git clone https://git.sr.ht/~dsemy/swsw
-$ cd swsw
-$ make
-@end example
-
-Install the package:
-
-@table @asis
-@item @kbd{M-x package-install-file RET /path/to/clone/swsw-VERSION.tar RET}
-@end table
-
 @node Usage
 @chapter Usage
 
-In order to use any feature of the package, @code{swsw-mode} must be enabled:
+In order to use any feature of the package, @code{wincom-mode} must be enabled:
 
 @table @asis
-@cindex swsw-mode
-@item @kbd{M-x swsw-mode RET}
-You can also add @code{(swsw-mode)} to your init file, or enable it
-through the customize interface.
+@cindex wincom-mode
+@item @kbd{M-x wincom-mode RET}
+You can also add @code{(wincom-mode)} to your initialization file, or
+enable it through the customize interface.
 @end table
 
-When @code{swsw-mode} is enabled, window IDs are shown as mode line
+When @code{wincom-mode} is enabled, window IDs are shown as mode line
 lighters of the form @code{<ID>} (by default, @xref{ID display}), and
-@code{other-window} (@kbd{C-x o}) is remapped to @code{swsw-select}.
+@code{other-window} (@kbd{C-x o}) is remapped to @code{wincom-select}.
+
+@code{wincom-select}, and any other window command, starts window
+selection (provided there are more than @code{wincom-minimum} windows,
+@xref{Window commands}).  During window selection, any window in the
+current @code{wincom-scope} (@xref{Customization}) can be selected by
+pressing the sequence of keys corresponding to its displayed ID.
+Alternatively, you can use any binding in @code{wincom-command-map},
+unless it is shadowed by a window ID.
 
 @table @asis
 @kindex C-x o
 @kindex C-x o o
-@cindex swsw-select
+@cindex wincom-select
 @item @kbd{C-x o ID}, @kbd{C-x o o ID}
 Select the window corresponding to ID in the current scope
-(@xref{Customization}) (@code{swsw-select}).
+(@xref{Customization}) (@code{wincom-select}).
 
 @kindex C-x o 0
-@cindex swsw-delete
+@cindex wincom-delete
 @item @kbd{C-x o 0 ID}
-Delete the window corresponding to ID in the current scope 
(@code{swsw-delete}).
+Delete the window corresponding to ID in the current scope
+(@code{wincom-delete}).
 
 @kindex C-x o 1
-@cindex swsw-delete-other
+@cindex wincom-delete-other
 @item @kbd{C-x o 1 ID}
 Make the window corresponding to ID in the current scope the sole
-window of its frame (@code{swsw-delete-other}).
+window of its frame (@code{wincom-delete-other}).
 
 @kindex C-x o 2
-@cindex swsw-split-window-below
+@cindex wincom-split-window-below
 @item @kbd{C-x o 2 ID}
 Split the window corresponding to ID in the current scope from below
-(@code{swsw-split-window-below}).  This window command accepts a
+(@code{wincom-split-window-below}).  This window command accepts a
 prefix argument (with the same semantics as @code{split-window-below}).
 
 @kindex C-x o 3
-@cindex swsw-split-window-right
+@cindex wincom-split-window-right
 @item @kbd{C-x o 3 ID}
 Split the window corresponding to ID in the current scope from the right
-(@code{swsw-split-window-right}).  This window command accepts a
+(@code{wincom-split-window-right}).  This window command accepts a
 prefix argument (with the same semantics as @code{split-window-right}).
 
 @kindex C-x o 4
-@cindex swsw-selected-window-prefix
+@cindex wincom-selected-window-prefix
 @item @kbd{C-x o 4 ID}
 Display the buffer of the next command in the window corresponding to
-ID in the current scope (@code{swsw-selected-window-prefix}).  This
+ID in the current scope (@code{wincom-selected-window-prefix}).  This
 window command is only available when
 @code{display-buffer-override-next-command} is available (Emacs 28+).
 
 @kindex C-x o t
-@cindex swsw-swap
+@cindex wincom-swap
 @item @kbd{C-x o t ID}
 Swap the states of the current window and the window corresponding to
-ID in the current scope (@code{swsw-swap}).
+ID in the current scope (@code{wincom-swap}).
 
 @kindex C-x o m
-@cindex swsw-select-minibuffer
+@cindex wincom-select-minibuffer
 @item @kbd{C-x o m}
-Switch to the minibuffer if it's active (@code{swsw-select-minibuffer}).
+Switch to the minibuffer if it's active (@code{wincom-select-minibuffer}).
 @end table
 
 @xref{Window commands} for information regarding defining new commands.
@@ -207,13 +181,13 @@ custom window commands, can be done through the customize 
interface:
 @item @kbd{M-x customize-group RET swsw RET}
 @end table
 
-@defopt swsw-id-chars
+@defopt wincom-id-chars
 Base set of character from which window IDs are constructed. This should be a
 list of characters. By default, the home row (@code{a s d f g h j k l}) is
 used.
 @end defopt
 
-@defopt swsw-scope
+@defopt wincom-scope
 Scope of all window operations. Used to determine on which frames to track
 windows. A value of @code{t} means consider all windows on all frames, @code{0}
 (the number zero) means consider all windows on all visible and iconified
@@ -231,34 +205,34 @@ frames, @code{visible} means consider all windows on all 
visible frames and
 @section ID display
 
 By default, the ID of each tracked window is displayed as a mode line
-lighter. This behavior is controlled by @code{swsw-display-lighter}.
+lighter. This behavior is controlled by @code{wincom-display-lighter}.
 
 Additionally, (custom) display functions could be added to
-@code{swsw-mode-hook}. These functions should enable ID display when
-@code{swsw-mode} is enabled, and disable ID display when
-@code{swsw-mode} is disabled. They can also make use of
-@code{swsw-before-command-hook} and @code{swsw-after-command-hook}
+@code{wincom-mode-hook}. These functions should enable ID display when
+@code{wincom-mode} is enabled, and disable ID display when
+@code{wincom-mode} is disabled. They can also make use of
+@code{wincom-before-command-hook} and @code{wincom-after-command-hook}
 (@xref{Window commands}) to display IDs only during window
 selection. See the description and implementation of
-@code{swsw-mode-line-display-function} and
-@code{swsw-mode-line-conditional-display-function} below for more
+@code{wincom-display-mode-line} and
+@code{wincom-display-mode-line-conditional} below for more
 information.
 
-It is also possible to use @code{swsw-format-id} directly in
+It is also possible to use @code{wincom-format-id} directly in
 e.g. @code{mode-line-format}, although details vary depending on how
 and where you want the IDs to be displayed.
 
-@defopt swsw-display-lighter
+@defopt wincom-display-lighter
 Whether or not to show a mode line lighter. A non-nil value means show
 a mode line lighter.  A value of @code{nil} means don't show a mode
 line lighter. By default, @code{t} is used.
 @end defopt
 
-@defopt swsw-mode-hook
-Hook run when enabling or disabling @code{swsw-mode}.
+@defopt wincom-mode-hook
+Hook run when enabling or disabling @code{wincom-mode}.
 @end defopt
 
-@defopt swsw-id-format
+@defopt wincom-id-format
 Format string for the window ID. Used in the mode line lighter, and
 display functions may use this format string to display the ID, but
 they can also ignore it. The string should contain a single occurrence
@@ -266,26 +240,26 @@ of @code{%s}, which will be replaced by the ID. By 
default,
 @code{" <%s>"} is used.
 @end defopt
 
-@defun swsw-format-id window
-Format an ID string (according to @code{swsw-id-format}) for WINDOW.
+@defun wincom-format-id window
+Format an ID string (according to @code{wincom-id-format}) for WINDOW.
 @end defun
 
-@defun swsw-mode-line-display-function
+@defun wincom-display-mode-line
 Reference implementation of a ``simple'' display function, displaying
 window IDs at the beginning of the mode line. Display window IDs if
-@code{swsw-mode} is enabled, and disable displaying window IDs if
-@code{swsw-mode} is disabled.  This display function respects
-@code{swsw-id-format}.
+@code{wincom-mode} is enabled, and disable displaying window IDs if
+@code{wincom-mode} is disabled.  This display function respects
+@code{wincom-id-format}.
 @end defun
 
-@defun swsw-mode-line-conditional-display-function
+@defun wincom-display-mode-line-conditional
 Reference implementation of a conditional display function, displaying
 window IDs at the beginning of the mode line during window selection.
-Add a hook to @code{swsw-before-command-hook} which displays window
-IDs on the mode line and add a hook to @code{swsw-after-command-hook}
-which hides window IDs from the mode line if @code{swsw-mode} is
-enabled, and remove those hooks if @code{swsw-mode} is disabled.  This
-display function respects @code{swsw-id-format}.
+Add a hook to @code{wincom-before-command-hook} which displays window
+IDs on the mode line and add a hook to @code{wincom-after-command-hook}
+which hides window IDs from the mode line if @code{wincom-mode} is
+enabled, and remove those hooks if @code{wincom-mode} is disabled.  This
+display function respects @code{wincom-id-format}.
 @end defun
 
 @node Window commands
@@ -293,24 +267,24 @@ display function respects @code{swsw-id-format}.
 
 Window commands are used to perform operations on specific windows,
 chosen by their ID (or the next window, if less than
-@code{swsw-minimum} (3 by default) windows are currently in scope).
-Alternatively, other commands available in @code{swsw-command-map} can
-be chosen. Not all commands in @code{swsw-command-map} are window
+@code{wincom-minimum} (3 by default) windows are currently in scope).
+Alternatively, other commands available in @code{wincom-command-map} can
+be chosen. Not all commands in @code{wincom-command-map} are window
 commands (by default).  For more information about included window
 commands, @xref{Usage}.
 
 Window commands can easily be defined using
-@code{swsw-define-window-command}.  For more complex use cases,
-the lower level @code{swsw-run-window-command} can be used.
+@code{wincom-define-window-command}.  For more complex use cases,
+the lower level @code{wincom-run-window-command} can be used.
 
-@defopt swsw-minimum
+@defopt wincom-minimum
 Minimum number of tracked windows for which interactive selection
 occurs when using window commands.  In practice, only window commands
-defined using @code{swsw-define-window-command} automatically adhere
+defined using @code{wincom-define-window-command} automatically adhere
 to this rule.
 @end defopt
 
-@defvar swsw--id-map
+@defvar wincom--id-map
 Key map which is populated automatically with elements corresponding
 to all tracked windows. The ID of each window is converted to a vector
 (to serve as a key sequence), and is bound to a command which calls
@@ -319,19 +293,19 @@ sole argument. There should be no reason to modify it 
directly; it is
 reset whenever window configuration is updated.
 @end defvar
 
-@defvar swsw-command-map
+@defvar wincom-command-map
 Key map which holds bindings to window commands. This key map is set
-as the parent of @code{swsw--id-map}, so all window commands are
+as the parent of @code{wincom--id-map}, so all window commands are
 available when it's active (unless they are shadowed by a window ID).
 @end defvar
 
-@defvar swsw-window-count
+@defvar wincom-window-count
 Amount of windows currently tracked, including the minibuffer (if it's
 active). It can be used to change the behavior of window commands (or
 display functions, @xref{ID display}).
 @end defvar
 
-@defmac swsw-define-window-command name (window [prefix] [minibuffer]) 
docstring body...
+@defmac wincom-define-window-command name (window [prefix] [minibuffer]) 
docstring body...
 Define NAME as a window command with DOCSTRING as its documentation
 string.  PREFIX (a symbol) is passed as an argument to the command
 (when not omitted or nil), with its value being the raw prefix
@@ -339,20 +313,20 @@ argument.
 
 BODY is used as the body of an anonymous function which receives
 WINDOW (a symbol) as an argument, with its value being a selected
-window.  If there are less than @code{swsw-minimum} (3 by default)
+window.  If there are less than @code{wincom-minimum} (3 by default)
 windows in the current scope (@xref{Customization}), the function is
 called with the window returned by @code{next-window}.  In this case,
 if MINIBUFFER is non-nil, it can be selected if it's active.
-Otherwise, the function is run using @code{swsw-run-window-command}.
+Otherwise, the function is run using @code{wincom-run-window-command}.
 @end defmac
 
-@defun swsw-run-window-command fun
-Run FUN as a window command. Run @code{swsw-before-command-hook}, set
-@code{this-command} to FUN, and set @code{swsw--id-map} as a transient
-map which runs @code{swsw-after-command-hook} on exit.  The hooks run
-by this function are expected by swsw to run for any window command
-which requires ID selection; they should be run even if
-this function isn't used when defining a new window command.
+@defun wincom-run-window-command fun
+Run FUN as a window command. Run @code{wincom-before-command-hook},
+set @code{this-command} to FUN, and set @code{wincom--id-map} as a
+transient map which runs @code{wincom-after-command-hook} on exit.
+The hooks run by this function are expected by Window Commander to run
+for any window command which requires ID selection; they should be run
+even if this function isn't used when defining a new window command.
 @end defun
 
 @node Keystroke Index



reply via email to

[Prev in Thread] Current Thread [Next in Thread]