summaryrefslogtreecommitdiff
path: root/lisp/keymap.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2022-06-18 11:08:23 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2022-06-18 11:22:58 +0200
commite321f87aa76c959faed784851b65ab7ada3fd129 (patch)
tree0f3450adff77e3a73df7b5786c39333b58e09e97 /lisp/keymap.el
parent15238e2ed0eeba82fd43efbbd4b9237394f9fd55 (diff)
downloademacs-e321f87aa76c959faed784851b65ab7ada3fd129.tar.gz
emacs-e321f87aa76c959faed784851b65ab7ada3fd129.tar.bz2
emacs-e321f87aa76c959faed784851b65ab7ada3fd129.zip
Avoid "control-control-KEY" (bug#55738)
Constructs such as ?\C-^@ or ?\C-\C-m literally apply a Control modifier twice which doesn't make sense at all. What is really meant is a C0 base character with the Control modifier bit set. This change is only stylistic in nature. * lisp/edmacro.el (edmacro-format-keys): * lisp/keymap.el (key-parse): * lisp/subr.el (event-modifiers, event-basic-type): * test/lisp/subr-tests.el (subr-test-kbd): Use \0 and \r instead of ^@ and \C-m to represent NUL and RET when combined with other modifiers.
Diffstat (limited to 'lisp/keymap.el')
-rw-r--r--lisp/keymap.el14
1 files changed, 7 insertions, 7 deletions
diff --git a/lisp/keymap.el b/lisp/keymap.el
index 71454eba5e5..3a22610499c 100644
--- a/lisp/keymap.el
+++ b/lisp/keymap.el
@@ -241,13 +241,13 @@ See `kbd' for a descripion of KEYS."
(setq bits (+ bits
(cdr
(assq (aref word 0)
- '((?A . ?\A-\^@) (?C . ?\C-\^@)
- (?H . ?\H-\^@) (?M . ?\M-\^@)
- (?s . ?\s-\^@) (?S . ?\S-\^@))))))
+ '((?A . ?\A-\0) (?C . ?\C-\0)
+ (?H . ?\H-\0) (?M . ?\M-\0)
+ (?s . ?\s-\0) (?S . ?\S-\0))))))
(setq prefix (+ prefix 2))
(setq word (substring word 2)))
(when (string-match "^\\^.$" word)
- (setq bits (+ bits ?\C-\^@))
+ (setq bits (+ bits ?\C-\0))
(setq prefix (1+ prefix))
(setq word (substring word 1)))
(let ((found (assoc word '(("NUL" . "\0") ("RET" . "\r")
@@ -262,19 +262,19 @@ See `kbd' for a descripion of KEYS."
(setq word (vector n))))
(cond ((= bits 0)
(setq key word))
- ((and (= bits ?\M-\^@) (stringp word)
+ ((and (= bits ?\M-\0) (stringp word)
(string-match "^-?[0-9]+$" word))
(setq key (mapcar (lambda (x) (+ x bits))
(append word nil))))
((/= (length word) 1)
(error "%s must prefix a single character, not %s"
(substring orig-word 0 prefix) word))
- ((and (/= (logand bits ?\C-\^@) 0) (stringp word)
+ ((and (/= (logand bits ?\C-\0) 0) (stringp word)
;; We used to accept . and ? here,
;; but . is simply wrong,
;; and C-? is not used (we use DEL instead).
(string-match "[@-_a-z]" word))
- (setq key (list (+ bits (- ?\C-\^@)
+ (setq key (list (+ bits (- ?\C-\0)
(logand (aref word 0) 31)))))
(t
(setq key (list (+ bits (aref word 0)))))))))