[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/window-commander cacd11a1b7 072/170: Prevent setting 's
From: |
ELPA Syncer |
Subject: |
[elpa] externals/window-commander cacd11a1b7 072/170: Prevent setting 'swsw-minibuffer-id' to a member of 'swsw-id-chars' |
Date: |
Wed, 28 Jun 2023 19:00:27 -0400 (EDT) |
branch: externals/window-commander
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’.
- [elpa] externals/window-commander f1693950a9 169/170: ; Bump version to 3.0, (continued)
- [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
- [elpa] externals/window-commander f0f65362d4 095/170: * swsw.el (swsw--set-id-chars): Use 'length' instead of 'nth', ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 2f7500636d 098/170: ; Add 'swsw' to .gitignore, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander cb2cb1e5cb 131/170: ; Small code style change, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander cacd11a1b7 072/170: Prevent setting 'swsw-minibuffer-id' to a member of 'swsw-id-chars',
ELPA Syncer <=
- [elpa] externals/window-commander 48e4811965 089/170: ; Remove (incorrect) description of the 'make all' target in the Makefile, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 862d945bdb 101/170: ; Ignore Emacs' backup files, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 95fc96e8c1 092/170: ; Add a link to the Info node in the customization buffer, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander cec8c4aacc 110/170: ; Edit docstrings to conform completely to 'checkdoc', ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander ca14f1d0c5 107/170: Mark some variables as risky local variables, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander ccab7194a7 133/170: Use 'custom-initialize-changed' to initialize some user options, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 92abfc5de4 119/170: ; Make some long lines short, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 841345d5cf 120/170: Define 'swsw-select' as a remapping of 'other-window', ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 910aea2c75 117/170: ; Declare all window commands should be called while 'swsw-mode' is active, ELPA Syncer, 2023/06/28
- [elpa] externals/window-commander 61700ece84 135/170: ; Fix indentation in a few places, ELPA Syncer, 2023/06/28