[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 9e46267: Rewrite kbd-valid-p to not use seq
From: |
Lars Ingebrigtsen |
Subject: |
master 9e46267: Rewrite kbd-valid-p to not use seq |
Date: |
Sun, 17 Oct 2021 13:26:04 -0400 (EDT) |
branch: master
commit 9e46267755e634c49122ea6decffc5b5c5017550
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Rewrite kbd-valid-p to not use seq
* lisp/subr.el (kbd-valid-p): Rewrite to not use seq.
---
lisp/subr.el | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/lisp/subr.el b/lisp/subr.el
index 6bd3b69..6359422 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -939,24 +939,27 @@ which is
(and (stringp keys)
(string-match-p "\\`[^ ]+\\( [^ ]+\\)*\\'" keys)
(save-match-data
- (seq-every-p
- (lambda (key)
- ;; Every key might have these modifiers, and they should be
- ;; in this order.
- (when (string-match
- "\\`\\(A-\\)?\\(C-\\)?\\(H-\\)?\\(M-\\)?\\(S-\\)?\\(s-\\)?"
- key)
- (setq key (substring key (match-end 0))))
- (or (and (= (length key) 1)
- ;; Don't accept control characters as keys.
- (not (< (aref key 0) ?\s))
- ;; Don't accept Meta'd characters as keys.
- (or (multibyte-string-p key)
- (not (<= 127 (aref key 0) 255))))
- (string-match-p "\\`<[A-Za-z0-9]+>\\'" key)
- (string-match-p
- "\\`\\(NUL\\|RET\\|TAB\\|LFD\\|ESC\\|SPC\\|DEL\\)\\'" key)))
- (split-string keys " ")))))
+ (catch 'exit
+ (dolist (key (split-string keys " "))
+ ;; Every key might have these modifiers, and they should be
+ ;; in this order.
+ (when (string-match
+ "\\`\\(A-\\)?\\(C-\\)?\\(H-\\)?\\(M-\\)?\\(S-\\)?\\(s-\\)?"
+ key)
+ (setq key (substring key (match-end 0))))
+ (unless (or (and (= (length key) 1)
+ ;; Don't accept control characters as keys.
+ (not (< (aref key 0) ?\s))
+ ;; Don't accept Meta'd characters as keys.
+ (or (multibyte-string-p key)
+ (not (<= 127 (aref key 0) 255))))
+ (string-match-p "\\`<[A-Za-z0-9]+>\\'" key)
+ (string-match-p
+ "\\`\\(NUL\\|RET\\|TAB\\|LFD\\|ESC\\|SPC\\|DEL\\)\\'"
+ key))
+ ;; Invalid.
+ (throw 'exit nil)))
+ t))))
(defun kbd (keys &optional need-vector)
"Convert KEYS to the internal Emacs key representation.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 9e46267: Rewrite kbd-valid-p to not use seq,
Lars Ingebrigtsen <=