branch: externals/window-commander commit 841345d5cfe7dc53c8869bb0c3771ebed10740fe Author: Daniel Semyonov <dan...@dsemy.com> Commit: Daniel Semyonov <dan...@dsemy.com>
Define 'swsw-select' as a remapping of 'other-window' * swsw.el (swsw-mode): Define 'swsw-mode-map' as a keymap with a single definition remapping 'other-window' to 'swsw-select'. --- NEWS | 9 +++++++++ swsw.el | 10 +++++++--- swsw.texi | 5 +++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 9a5cb43d55..600a1faf96 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,15 @@ swsw NEWS -- history of user-visible changes. See the end of the file for an explanation of the versioning scheme. +* 2.1.0 + +** Remap 'other-window' to 'swsw-select' when 'swsw-mode' is active. +By default this changes nothing since the default binding for +'other-window' is 'C-x o'. +This change has been made to add (simple) out-of-the-box compatibility +with alternative key binding sets or different Emacs distributions +(provided they bind 'other-window'). + * 2.0.2 ** No user visible changes. diff --git a/swsw.el b/swsw.el index 351fc1effb..9aa642cc69 100644 --- a/swsw.el +++ b/swsw.el @@ -46,6 +46,7 @@ ;; function (see `swsw-display-function'). ;; - 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. ;; @@ -332,15 +333,18 @@ selection.") (define-minor-mode swsw-mode "Minor mode for simple window management. +When the mode is active, `other-window' is remapped to `swsw-select'. + The following key bindings are available after starting window selection: \\{swsw-command-map}" :global t - :lighter - (:eval (when (eq swsw-display-function 'lighter) + :lighter (:eval (when (eq swsw-display-function 'lighter) (swsw-format-id (selected-window)))) - :keymap '(keymap (?\C-x . (keymap (?o . swsw-select)))) + :keymap (let ((map (make-sparse-keymap))) + (define-key map [remap other-window] #'swsw-select) + map) (if swsw-mode (progn (swsw--update) diff --git a/swsw.texi b/swsw.texi index 3dbe1ed2e9..9781fb9510 100644 --- a/swsw.texi +++ b/swsw.texi @@ -136,8 +136,9 @@ In order to use any feature of the package, @code{swsw-mode} must be enabled: You can also add @code{(swsw-mode)} to your init file, instead. @end table -By default, window IDs will be shown as mode line lighters of the -form @code{<ID>}. +By default, window IDs are shown as mode line lighters of the +form @code{<ID>} (@xref{Display functions}), and @code{other-window} +(@kbd{C-x o}) is remapped to @code{swsw-select}. @kindex C-x o @cindex swsw-select