branch: externals/window-commander commit 6a70afa84f0a2dbd95b9d613243fb183565a23dd Author: Daniel Semyonov <cm...@dsemy.com> Commit: Daniel Semyonov <cm...@dsemy.com>
; Documentation fixes --- NEWS | 2 +- swsw.el | 10 +++++++++- swsw.texi | 21 +++++++-------------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/NEWS b/NEWS index 0f0da776b3..f9a483552b 100644 --- a/NEWS +++ b/NEWS @@ -128,7 +128,7 @@ through the customize interface). A MAJOR version bump is very unlikely. The MINOR version is bumped when a feature is added in a non-breaking way. -The PATCH version is bumped when a no feature is added (e.g. a version +The PATCH version is bumped when no feature is added (e.g. a version with only fixes, or changes to documentation). Note that versions before 1.0 did not follow this scheme. diff --git a/swsw.el b/swsw.el index 9d33cdf27a..498cab9f0f 100644 --- a/swsw.el +++ b/swsw.el @@ -114,7 +114,7 @@ t means consider all windows on all existing frames. :tag "All windows on all visible and iconified frames" 0) (const :tag "All windows on all visible frames" visible) (const - :tag "All window on the currently selected frame" + :tag "All windows on the currently selected frame" current)) :set #'swsw--set-scope :package-version '(swsw . 1.1)) @@ -175,6 +175,8 @@ If set to ‘lighter’, use the mode line lighter of ‘swsw-mode’." "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’. @@ -194,6 +196,12 @@ If set to ‘lighter’, use the mode line lighter of ‘swsw-mode’." nil) (swsw--next-id)))) (when 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) diff --git a/swsw.texi b/swsw.texi index 6467636e3e..9c3f571729 100644 --- a/swsw.texi +++ b/swsw.texi @@ -217,16 +217,6 @@ will be @code{t} when enabling @code{swsw-mode} and @code{nil} when disabling it. By default, @code{lighter} is used. @end defopt -@defvar swsw-before-select-hook -Hook which runs after @code{swsw-select} is called, but before and ID has been -read. This hook can be used display window IDs conditionally. -@end defvar - -@defvar swsw-after-select-hook -Hook which runs after reading an ID, or if the user interrupts -@code{swsw--read-id}. This hook can be used hide window IDs conditionally. -@end defvar - @defun swsw-mode-line-display-function switch Reference implementation of a ``simple'' display function. Display window IDs on the mode line if SWITCH isn't @code{nil}, and hide window IDs from the mode @@ -236,8 +226,8 @@ line if SWITCH is @code{nil}. This display function respects @defun swsw-mode-line-conditional-display-function switch Reference implementation of a conditional display function. Add a hook to -@code{swsw-before-select-hook} which displays window IDs on the mode line and -add a hook to @code{swsw-after-select-hook} which hides window IDs from the +@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 SWITCH isn't @code{nil}, and remove those hooks if SWITCH is @code{nil}. This display function respects @code{swsw-id-format}. @end defun @@ -247,7 +237,7 @@ mode line if SWITCH isn't @code{nil}, and remove those hooks if SWITCH is Window commands are used to perform operations on specific windows. They are normal commands (interactive functions) which are -bound to key in @code{swsw-command-map}. @code{swsw-select}, +bound to a key sequence in @code{swsw-command-map}. @code{swsw-select}, @code{swsw-select-minibuffer} and @code{swsw-delete} are implemented as window commands. @@ -276,7 +266,10 @@ conditionally run window commands. 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. This function -can be used to easily define new window commands. +can be used to easily define new window commands. The hooks ran by +this function are expected by swsw to run for any window command which +requires ID selection; they should be manually added even if this +function isn't used when defining a new window command. @end defun @node Keystroke Index