[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/window-commander 366972729f 162/170: Improve user optio
From: |
ELPA Syncer |
Subject: |
[elpa] externals/window-commander 366972729f 162/170: Improve user option error checking and updating |
Date: |
Wed, 28 Jun 2023 19:00:36 -0400 (EDT) |
branch: externals/window-commander
commit 366972729ff2ee26cd1b8c21562b60f6385bee76
Author: Daniel Semyonov <daniel@dsemy.com>
Commit: Daniel Semyonov <daniel@dsemy.com>
Improve user option error checking and updating
* swsw.el (swsw--set-and-maybe-update): New function.
(swsw-id-chars): Use the ':validate' type keyword for error checking,
and set value using 'swsw--set-and-maybe-update'.
(swsw-scope): Set value using 'swsw--set-and-maybe-update'.
(swsw-display-lighter): If new value is a function, call it with the
value of 'swsw-mode' as the argument instead of 't'.
---
swsw.el | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/swsw.el b/swsw.el
index 55d588630b..8958230486 100644
--- a/swsw.el
+++ b/swsw.el
@@ -94,18 +94,25 @@
: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 character)
+ :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 (lambda (sym chars)
- (unless (nth 1 chars)
- (user-error
- "`swsw-id-chars' should contain at least two characters"))
- (set-default sym chars)
- (swsw--update))
+ :set #'swsw--set-and-maybe-update
:risky t
:package-version '(swsw . 1.0))
@@ -125,9 +132,7 @@ This list should contain at least two characters."
:tag "All windows on the currently selected frame"
current))
:initialize #'custom-initialize-changed
- :set (lambda (sym scope)
- (set-default sym scope)
- (swsw--update))
+ :set #'swsw--set-and-maybe-update
:risky t
:package-version '(swsw . 1.1))
@@ -159,8 +164,8 @@ compatibility (see `swsw-display-function')."
(and (boundp sym) (functionp (symbol-value sym))
(funcall (symbol-value sym) nil))
(set-default sym fun)
- (when (functionp fun)
- (funcall fun t)))
+ (and (boundp swsw-mode) (functionp fun)
+ (funcall fun swsw-mode)))
:package-version '(swsw . 2.2))
(defcustom swsw-mode-hook nil
- [elpa] externals/window-commander 9f3b010d65 147/170: ; Indicate ELPA installation is now possible in the README, (continued)
- [elpa] externals/window-commander 9f3b010d65 147/170: ; Indicate ELPA installation is now possible in the README, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 0d7bf97dbb 142/170: ; Prepare for NonGNU ELPA inclusion, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 2b43f66c82 145/170: ; Use 'kbd' instead of vector notation for 'define-key' example, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander c864e6d524 144/170: ; Add change log for version 2.1.1, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 57a040f4be 140/170: ; Indicate the mailing list is the "maintainer" of the package, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander dd9520bf53 149/170: Change some instances of 'if' and 'let' to use 'if-let', ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 9767e52e8c 150/170: ; Replace (unnecessary) backticks with normal quotes, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander d46309a7a8 151/170: Rework display functions, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 385c2f9602 166/170: ; Fix remaining wrong references to swsw, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander c4c77ddf34 161/170: ; Update introduction, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 366972729f 162/170: Improve user option error checking and updating,
ELPA Syncer <=
- [elpa] externals/window-commander b1cf47530d 155/170: ; Small change and fix to README and commentary, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 447e7c18b9 165/170: ; Clean .gitignore, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 76b11d7b76 154/170: ; Add a space between the name of the manual and a section name, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander f1693950a9 169/170: ; Bump version to 3.0, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 93814ae925 158/170: ; Fix swsw-pkg.el generation on OpenBSD, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander a46fab04cd 168/170: Improve implementation of keywords in 'wincom-define-window-command', ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander e43021aa7e 112/170: * swsw.el (swsw-format-id): Use 'format-spec' instead of 'format', ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 6a70afa84f 097/170: ; Documentation fixes, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 435e462891 115/170: ; Fix the required Emacs version in swsw-pkg.el, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander e7646bf372 129/170: ; Bump to version 2.1, ELPA Syncer, 2023/06/28