[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swsw cacd11a1b7 072/146: Prevent setting 'swsw-minibuffer-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swsw cacd11a1b7 072/146: Prevent setting 'swsw-minibuffer-id' to a member of 'swsw-id-chars' |
Date: |
Wed, 25 May 2022 02:59:47 -0400 (EDT) |
branch: elpa/swsw
commit cacd11a1b7ded826c837f3c2f0b5b19d66355549
Author: Daniel Semyonov <cmstr@dsemy.com>
Commit: Daniel Semyonov <cmstr@dsemy.com>
Prevent setting 'swsw-minibuffer-id' to a member of 'swsw-id-chars'
* swsw.el (swsw--set-id-chars): Ensure 'swsw-minibuffer-id' isn't a
member of the new list of characters.
(swsw--set-minibuffer-id): New function which sets
'swsw-minibuffer-id' after ensuring it is not a member of
'swsw-id-chars'.
(swsw-minibuffer-id): Set 'set' function to 'swsw--set-minibuffer-id'.
---
swsw.el | 37 +++++++++++++++++++++++++++----------
1 file changed, 27 insertions(+), 10 deletions(-)
diff --git a/swsw.el b/swsw.el
index 235c1504f8..547bc48294 100644
--- a/swsw.el
+++ b/swsw.el
@@ -68,24 +68,41 @@
(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
+Check that the new list has at least two elements, check that no
+element is equal to ‘swsw-minibuffer-id’, set SYM’s value to
CHARS, and call ‘swsw-update’."
- (if (< (length chars) 2)
- (user-error
- "‘swsw-id-chars’ should contain at least two characters")
- (set-default sym chars)
- (when (fboundp 'swsw-update)
- (swsw-update))))
+ (cond ((< (length chars) 2)
+ (user-error
+ "‘swsw-id-chars’ should contain at least two characters"))
+ ((memq ?m chars)
+ (user-error
+ "‘swsw-id-chars’ shouldn't contain ‘swsw-minibuffer-id’"))
+ (t
+ (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."
+This list should contain at least two characters.
+No character in this list should be equal to ‘swsw-minibuffer-id’."
:type '(repeat character)
:set #'swsw--set-id-chars)
+(defun swsw--set-minibuffer-id (sym id)
+ "Set the variable ‘swsw-minbuffer-id’.
+Check that ID isn't a member of ‘swsw-id-chars’ and set SYM’s value to
+ID."
+ (if (memq id swsw-id-chars)
+ (user-error
+ "‘swsw-minibuffer-id’ shouldn't be a member of ‘swsw-id-chars’")
+ (set-default sym id)))
+
(defcustom swsw-minibuffer-id ?m
- "ID reserved for the minibuffer."
- :type '(character))
+ "ID reserved for the minibuffer.
+This character shouldn't appear in ‘swsw-id-chars’."
+ :type '(character)
+ :set #'swsw--set-minibuffer-id)
(defun swsw--set-scope (sym scope)
"Set the variable ‘swsw-scope’.
- [nongnu] branch elpa/swsw created (now bbe31e347c), ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 024502f51f 017/146: * swsw.el (swsw-mode): Don't call 'force-mode-line-update', ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 24720bfbe7 008/146: ; Bump version to 0.2, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw ba9e82c95f 001/146: initial commit, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 1a5ce9c559 038/146: ; Add binding 'C-x o' to 'swsw-select' in 'swsw-mode-map' to the NEWS, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 7a00ef3140 039/146: ; Small documentation fixes, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw b0b55f010c 041/146: ; Improve the docstrings for the reference display functions, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 5937f8bc6e 043/146: ; Update .gitignore to ignore some build artifacts, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw d5ab98b9db 044/146: ; Bump version to 1.1, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 5e77d34dfa 054/146: ; Modify installation section of the README file and Info node, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw cacd11a1b7 072/146: Prevent setting 'swsw-minibuffer-id' to a member of 'swsw-id-chars',
ELPA Syncer <=
- [nongnu] elpa/swsw dd65e7c8af 139/146: ; Update copyright years, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw ac8efcbbd1 007/146: Assign a unique ID to an active minibuffer, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 08b56d124c 015/146: Add support for multi-character IDs, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 185861a2e9 010/146: Use a lighter for 'swsw-mode', ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 6a9b3544c9 002/146: ; Fix 'git clone' example command in README file, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 15e188aa17 009/146: Fix some edge cases related to the minibuffer, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 0aef3311c6 014/146: ; Bump to version 0.3, ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 9873ff1bd2 020/146: * swsw.el (swsw-select): Add before and after hooks., ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 4a7ea31b37 036/146: * swsw.el (swsw-mode): Bind 'C-x o' to 'swsw-select', ELPA Syncer, 2022/05/25
- [nongnu] elpa/swsw 63e295f599 025/146: Add a user option to customize the scope of window tracking, ELPA Syncer, 2022/05/25