summaryrefslogtreecommitdiff
path: root/lisp/edmacro.el
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1995-02-08 03:50:54 +0000
committerKarl Heuer <kwzh@gnu.org>1995-02-08 03:50:54 +0000
commitf53d410d7be3370d95e688f258a010bc00eba4a9 (patch)
treea74ae36921977052b1aae595b549fc1736e8d704 /lisp/edmacro.el
parent0fe41ea7ec6638673a3953ae8060581b6e40f87b (diff)
downloademacs-f53d410d7be3370d95e688f258a010bc00eba4a9.tar.gz
(edmacro-format-keys, edmacro-parse-keys): Don't presume internal bit layout
of non-ASCII keys.
Diffstat (limited to 'lisp/edmacro.el')
-rw-r--r--lisp/edmacro.el27
1 files changed, 14 insertions, 13 deletions
diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index 5753ae216dd..8c9eaa2ed09 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -397,7 +397,7 @@ doubt, use whitespace."
(when (stringp macro)
(loop for i below (length macro) do
(when (>= (aref rest-mac i) 128)
- (incf (aref rest-mac i) (- (lsh 1 23) 128)))))
+ (incf (aref rest-mac i) (- ?\M-\^@ 128)))))
(while (not (eq (aref rest-mac 0) 'end-macro))
(let* ((prefix
(or (and (integerp (aref rest-mac 0))
@@ -494,8 +494,9 @@ doubt, use whitespace."
((integerp ch)
(concat
(loop for pf across "ACHMsS"
- for bit in '(18 22 20 23 19 21)
- when (/= (logand ch (lsh 1 bit)) 0)
+ for bit in '(?\A-\^@ ?\C-\^@ ?\H-\^@
+ ?\M-\^@ ?\s-\^@ ?\S-\^@)
+ when (/= (logand ch bit) 0)
concat (format "%c-" pf))
(let ((ch2 (logand ch (1- (lsh 1 18)))))
(cond ((<= ch2 32)
@@ -602,14 +603,14 @@ doubt, use whitespace."
(t
(let ((orig-word word) (prefix 0) (bits 0))
(while (string-match "^[ACHMsS]-." word)
- (incf bits (lsh 1 (cdr (assq (aref word 0)
- '((?A . 18) (?C . 22)
- (?H . 20) (?M . 23)
- (?s . 19) (?S . 21))))))
+ (incf bits (cdr (assq (aref word 0)
+ '((?A . ?\A-\^@) (?C . ?\C-\^@)
+ (?H . ?\H-\^@) (?M . ?\M-\^@)
+ (?s . ?\s-\^@) (?S . ?\S-\^@)))))
(incf prefix 2)
(callf substring word 2))
(when (string-match "^\\^.$" word)
- (incf bits (lsh 1 22))
+ (incf bits ?\C-\^@)
(incf prefix)
(callf substring word 1))
(let ((found (assoc word '(("NUL" . "\0") ("RET" . "\r")
@@ -623,15 +624,15 @@ doubt, use whitespace."
finally do (setq word (vector n))))
(cond ((= bits 0)
(setq key word))
- ((and (= bits (lsh 1 23)) (stringp word)
+ ((and (= bits ?\M-\^@) (stringp word)
(string-match "^-?[0-9]+$" word))
(setq key (loop for x across word collect (+ x bits))))
((/= (length word) 1)
(error "%s must prefix a single character, not %s"
(substring orig-word 0 prefix) word))
- ((and (/= (logand bits (lsh 1 22)) 0) (stringp word)
+ ((and (/= (logand bits ?\C-\^@) 0) (stringp word)
(string-match "[@-_.a-z?]" word))
- (setq key (list (+ bits (- (lsh 1 22))
+ (setq key (list (+ bits (- ?\C-\^@)
(if (equal word "?") 127
(logand (aref word 0) 31))))))
(t
@@ -647,10 +648,10 @@ doubt, use whitespace."
(if (and (not need-vector)
(loop for ch across res
always (and (integerp ch)
- (let ((ch2 (logand ch (lognot (lsh 1 23)))))
+ (let ((ch2 (logand ch (lognot ?\M-\^@))))
(and (>= ch2 0) (<= ch2 127))))))
(concat (loop for ch across res
- collect (if (= (logand ch (lsh 1 23)) 0)
+ collect (if (= (logand ch ?\M-\^@) 0)
ch (+ ch 128))))
res)))