comparison lisp/macros.el @ 12923:f1e05398634b

(insert-kbd-macro): Express vector char modifiers with escape prefixes. Express big basic char codes in octal.
author Richard M. Stallman <rms@gnu.org>
date Tue, 22 Aug 1995 16:47:19 +0000
parents e6bdaaa6ce1b
children 83f275dcd93a
comparison
equal deleted inserted replaced
12922:e171a85fd6b0 12923:f1e05398634b
114 (insert "\\M-" (- char 128))) 114 (insert "\\M-" (- char 128)))
115 ((= char 255) 115 ((= char 255)
116 (delete-region (point) (1+ (point))) 116 (delete-region (point) (1+ (point)))
117 (insert "\\M-\\C-?")))))) 117 (insert "\\M-\\C-?"))))))
118 (if (vectorp definition) 118 (if (vectorp definition)
119 (let ((len (length definition)) (i 0) char) 119 (let ((len (length definition)) (i 0) char mods)
120 (while (< i len) 120 (while (< i len)
121 (insert (if (zerop i) ?\[ ?\ )) 121 (insert (if (zerop i) ?\[ ?\ ))
122 (setq char (aref definition i) 122 (setq char (aref definition i)
123 i (1+ i)) 123 i (1+ i))
124 (cond ((not (and (wholenump char) (< char 256))) 124 (cond ((not (numberp char))
125 (prin1 char (current-buffer))) 125 (prin1 char (current-buffer)))
126 ((= char 0) 126 (t
127 (insert "?\\C-@")) 127 (insert "?")
128 ((< char 27) 128 (setq mods (event-modifiers char)
129 (insert "?\\C-" (+ 96 char))) 129 char (event-basic-type char))
130 ((= char ?\C-\\) 130 (while mods
131 (insert "?\\C-\\\\")) 131 (cond ((eq (car mods) 'control)
132 ((< char 32) 132 (insert "\\C-"))
133 (insert "?\\C-" (+ 64 char))) 133 ((eq (car mods) 'meta)
134 ((< char 127) 134 (insert "\\M-"))
135 (insert ?? char)) 135 ((eq (car mods) 'hyper)
136 ((= char 127) 136 (insert "\\H-"))
137 (insert "?\\C-?")) 137 ((eq (car mods) 'super)
138 ((= char 128) 138 (insert "\\s-"))
139 (insert "?\\M-\\C-@")) 139 ((eq (car mods) 'alt)
140 ((= char (aref "\M-\C-\\" 0)) 140 (insert "\\A-"))
141 (insert "?\\M-\\C-\\\\")) 141 ((and (eq (car mods) 'shift)
142 ((< char 155) 142 (>= char ?a)
143 (insert "?\\M-\\C-" (- char 32))) 143 (<= char ?z))
144 ((< char 160) 144 (setq char (upcase char)))
145 (insert "?\\M-\\C-" (- char 64))) 145 ((eq (car mods) 'shift)
146 ((= char (aref "\M-\\" 0)) 146 (insert "\\S-")))
147 (insert "?\\M-\\\\")) 147 (setq mods (cdr mods)))
148 ((< char 255) 148 (cond ((= char ?\\)
149 (insert "?\\M-" (- char 128))) 149 (insert "\\\\"))
150 ((= char 255) 150 ((= char 127)
151 (insert "?\\M-\\C-?")))) 151 (insert "\\C-?"))
152 ((< char 127)
153 (insert char))
154 (t (insert "\\" (format "%o" char)))))))
152 (insert ?\])) 155 (insert ?\]))
153 (prin1 definition (current-buffer)))) 156 (prin1 definition (current-buffer))))
154 (insert ")\n") 157 (insert ")\n")
155 (if keys 158 (if keys
156 (let ((keys (where-is-internal macroname '(keymap)))) 159 (let ((keys (where-is-internal macroname '(keymap))))