[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/window-commander b5ebc9e08a 106/170: Use lambdas for ':
From: |
ELPA Syncer |
Subject: |
[elpa] externals/window-commander b5ebc9e08a 106/170: Use lambdas for ':set' functions |
Date: |
Wed, 28 Jun 2023 19:00:30 -0400 (EDT) |
branch: externals/window-commander
commit b5ebc9e08a9fbc070bfe89894374b1e45e6f567e
Author: Daniel Semyonov <daniel@dsemy.com>
Commit: Daniel Semyonov <daniel@dsemy.com>
Use lambdas for ':set' functions
* swsw.el (swsw--set-id-chars, swsw-id-chars, swsw--set-scope)
(swsw-scope, swsw--set-display-function, swsw-display-function):
Remove ':set' functions in favor of using (identical) lambdas in the
respective custom variables.
---
swsw.el | 50 ++++++++++++++++++--------------------------------
1 file changed, 18 insertions(+), 32 deletions(-)
diff --git a/swsw.el b/swsw.el
index 098025d604..f66a08b981 100644
--- a/swsw.el
+++ b/swsw.el
@@ -78,30 +78,19 @@
:group 'convenience
:prefix "swsw-")
-(defun swsw--set-id-chars (sym chars)
- "Set the variable `swsw-id-chars'.
-Check that the new list has at least two elements, set SYM's value to
-CHARS, and call `swsw-update'."
- (unless (nth 1 chars)
- (user-error "`swsw-id-chars' should contain at least two characters"))
- (set-default sym chars)
- (when (fboundp 'swsw-update)
- (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."
:type '(repeat character)
- :set #'swsw--set-id-chars
+ :set (lambda (sym chars)
+ (unless (nth 1 chars)
+ (user-error
+ "`swsw-id-chars' should contain at least two characters"))
+ (set-default sym chars)
+ (when (fboundp 'swsw-update)
+ (swsw-update)))
:package-version '(swsw . 1.0))
-(defun swsw--set-scope (sym scope)
- "Set the variable `swsw-scope'.
-Set SYM's value to SCOPE and call `swsw-update'."
- (set-default sym scope)
- (when (fboundp 'swsw-update)
- (swsw-update)))
-
(defcustom swsw-scope t
"Scope of all window operations.
t means consider all windows on all existing frames.
@@ -116,21 +105,12 @@ t means consider all windows on all existing frames.
(const
:tag "All windows on the currently selected frame"
current))
- :set #'swsw--set-scope
+ :set (lambda (sym scope)
+ (set-default sym scope)
+ (when (fboundp 'swsw-update)
+ (swsw-update)))
:package-version '(swsw . 1.1))
-(defun swsw--set-display-function (sym fun)
- "Set the variable `swsw-display-function'.
-Call the previous display function with nil as the sole argument
-\(turning it off), set SYM's value to FUN, and call FUN with t as the
-sole argument (turning it on)."
- (unless (or (not (boundp 'swsw-display-function))
- (eq swsw-display-function 'lighter))
- (funcall swsw-display-function nil))
- (set-default sym fun)
- (unless (eq fun 'lighter)
- (funcall fun t)))
-
(defcustom swsw-display-function 'lighter
"Function used to display the ID of each window.
This function is called with t as the sole argument when enabling
@@ -138,7 +118,13 @@ This function is called with t as the sole argument when
enabling
If set to `lighter', use the mode line lighter of `swsw-mode'."
:type '(radio (const :tag "Mode line lighter" lighter)
(function :tag "Display function"))
- :set #'swsw--set-display-function
+ :set (lambda (sym fun)
+ (unless (or (not (boundp 'swsw-display-function))
+ (eq swsw-display-function 'lighter))
+ (funcall swsw-display-function nil))
+ (set-default sym fun)
+ (unless (eq fun 'lighter)
+ (funcall fun t)))
:package-version '(swsw . 1.0))
(defcustom swsw-id-format " <%s>"
- [elpa] externals/window-commander e774ead908 104/170: ; Update mail address, (continued)
- [elpa] externals/window-commander e774ead908 104/170: ; Update mail address, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander af99790728 123/170: ; Various cosmetic changes to NEWS, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander c620c3028c 160/170: ; swsw.text: Fix typos and update information, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander f41a366777 159/170: ; Bump version to 2.3, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 95c25ee03c 022/170: ; Bump version to 1.0 and update README, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 51b8c1eb7c 080/170: ; Update documentation according to latest changes, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander c378be9bae 130/170: ; Load 'subr-x' when compiling, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 444873d9bd 114/170: Fix names of some internal and some external functions, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 8a9686e0fe 111/170: ; Change required Emacs version according to package-lint, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 85d9c690b1 102/170: ; Add key binding to swsw-mode's docstring, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander b5ebc9e08a 106/170: Use lambdas for ':set' functions,
ELPA Syncer <=
- [elpa] externals/window-commander b2dcc60dab 136/170: ; Explain 'swsw--id-counter' more thoroughly, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander bbe31e347c 146/170: ; Bump version to 2.1.1, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 0d361df85e 148/170: ; Use 'kbd' notation in the README, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander c5f85632d9 156/170: Rework display functions, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander ae9876b2c6 163/170: Rename to Window Commander and simplify project, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 43d93402a8 167/170: ; Small fix, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander ff30079d41 075/170: ; Remove trailing period in a tag string of 'swsw-scope', ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 07f26210e8 086/170: ; Add 'swsw-delete' fix to the NEWS file, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 8b74678bcf 028/170: * swsw.el (swsw-display-function): Avoid byte compilation warning, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 54ca1baa14 030/170: ; Restructure README and commentary, ELPA Syncer, 2023/06/28