[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swsw b5ebc9e08a 106/146: Use lambdas for ':set' functions
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swsw b5ebc9e08a 106/146: Use lambdas for ':set' functions |
Date: |
Wed, 25 May 2022 02:59:52 -0400 (EDT) |
branch: elpa/swsw
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>"
- [nongnu] elpa/swsw 95c25ee03c 022/146: ; Bump version to 1.0 and update README, (continued)
- [nongnu] elpa/swsw 95c25ee03c 022/146: ; Bump version to 1.0 and update README, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 2002152fb7 023/146: ; Add .gitignore file, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw f0f65362d4 095/146: * swsw.el (swsw--set-id-chars): Use 'length' instead of 'nth', ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw bd1e527d83 121/146: * swsw.el (swsw-select, swsw-delete): Respect 'swsw-scope', ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw cb2cb1e5cb 131/146: ; Small code style change, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw dbe46d5b86 070/146: * swsw.el (swsw-select): Don't select the next window for non-existent IDs, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 435e462891 115/146: ; Fix the required Emacs version in swsw-pkg.el, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw b2dcc60dab 136/146: ; Explain 'swsw--id-counter' more thoroughly, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 3f507e91c0 006/146: ; Fix docstring for 'swsw-mode', ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 6695f8858e 034/146: ; Use '; ' for inline comment instead of '; ; ', ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw b5ebc9e08a 106/146: Use lambdas for ':set' functions,
ELPA Syncer <=
- [nongnu] elpa/swsw 04ace20d03 063/146: ; Fix indentation and compact structure in some places, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 5addab5009 027/146: ; Fix installing swsw.el as a package, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 95fc96e8c1 092/146: ; Add a link to the Info node in the customization buffer, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw ebaa85abdd 031/146: ; Add a missing word to a comment, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 7d6968aa65 093/146: ; Bump version to 2.0.1, ELPA Syncer, 2022/05/25