aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/keymap.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/keymap.el')
-rw-r--r--lisp/keymap.el64
1 files changed, 32 insertions, 32 deletions
diff --git a/lisp/keymap.el b/lisp/keymap.el
index ce566fd8afc..c0fdf8721b2 100644
--- a/lisp/keymap.el
+++ b/lisp/keymap.el
@@ -325,38 +325,38 @@ which is
325 325
326 Alt-Control-Hyper-Meta-Shift-super" 326 Alt-Control-Hyper-Meta-Shift-super"
327 (declare (pure t) (side-effect-free t)) 327 (declare (pure t) (side-effect-free t))
328 (and 328 (let ((case-fold-search nil))
329 (stringp keys) 329 (and
330 (string-match-p "\\`[^ ]+\\( [^ ]+\\)*\\'" keys) 330 (stringp keys)
331 (save-match-data 331 (string-match-p "\\`[^ ]+\\( [^ ]+\\)*\\'" keys)
332 (catch 'exit 332 (save-match-data
333 (let ((prefixes 333 (catch 'exit
334 "\\(A-\\)?\\(C-\\)?\\(H-\\)?\\(M-\\)?\\(S-\\)?\\(s-\\)?") 334 (let ((prefixes
335 (case-fold-search nil)) 335 "\\(A-\\)?\\(C-\\)?\\(H-\\)?\\(M-\\)?\\(S-\\)?\\(s-\\)?"))
336 (dolist (key (split-string keys " ")) 336 (dolist (key (split-string keys " "))
337 ;; Every key might have these modifiers, and they should be 337 ;; Every key might have these modifiers, and they should be
338 ;; in this order. 338 ;; in this order.
339 (when (string-match (concat "\\`" prefixes) key) 339 (when (string-match (concat "\\`" prefixes) key)
340 (setq key (substring key (match-end 0)))) 340 (setq key (substring key (match-end 0))))
341 (unless (or (and (= (length key) 1) 341 (unless (or (and (= (length key) 1)
342 ;; Don't accept control characters as keys. 342 ;; Don't accept control characters as keys.
343 (not (< (aref key 0) ?\s)) 343 (not (< (aref key 0) ?\s))
344 ;; Don't accept Meta'd characters as keys. 344 ;; Don't accept Meta'd characters as keys.
345 (or (multibyte-string-p key) 345 (or (multibyte-string-p key)
346 (not (<= 127 (aref key 0) 255)))) 346 (not (<= 127 (aref key 0) 255))))
347 (and (string-match-p "\\`<[-_A-Za-z0-9]+>\\'" key) 347 (and (string-match-p "\\`<[-_A-Za-z0-9]+>\\'" key)
348 ;; Don't allow <M-C-down>. 348 ;; Don't allow <M-C-down>.
349 (= (progn 349 (= (progn
350 (string-match 350 (string-match
351 (concat "\\`<" prefixes) key) 351 (concat "\\`<" prefixes) key)
352 (match-end 0)) 352 (match-end 0))
353 1)) 353 1))
354 (string-match-p 354 (string-match-p
355 "\\`\\(NUL\\|RET\\|TAB\\|LFD\\|ESC\\|SPC\\|DEL\\)\\'" 355 "\\`\\(NUL\\|RET\\|TAB\\|LFD\\|ESC\\|SPC\\|DEL\\)\\'"
356 key)) 356 key))
357 ;; Invalid. 357 ;; Invalid.
358 (throw 'exit nil))) 358 (throw 'exit nil)))
359 t))))) 359 t))))))
360 360
361(defun key-translate (from to) 361(defun key-translate (from to)
362 "Translate character FROM to TO on the current terminal. 362 "Translate character FROM to TO on the current terminal.