# HG changeset patch # User Karl Heuer # Date 792215454 0 # Node ID 58ab3325da3b25e6d4eff65c3487e00f34dbc122 # Parent 37ced05a96d0f91bd7759d200c488106eca4feaf (edmacro-format-keys, edmacro-parse-keys): Don't presume internal bit layout of non-ASCII keys. diff -r 37ced05a96d0 -r 58ab3325da3b lisp/edmacro.el --- a/lisp/edmacro.el Wed Feb 08 01:26:46 1995 +0000 +++ b/lisp/edmacro.el Wed Feb 08 03:50:54 1995 +0000 @@ -397,7 +397,7 @@ (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 @@ ((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 @@ (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 @@ 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 @@ (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)))