Mercurial > emacs
comparison lisp/macros.el @ 95148:97ef76fbfb23
(insert-kbd-macro): Use prin1-char.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 21 May 2008 02:32:31 +0000 |
parents | ee5932bf781d |
children | a9dc0e7c3f2b |
comparison
equal
deleted
inserted
replaced
95147:5d23775277d2 | 95148:97ef76fbfb23 |
---|---|
129 (let ((len (length definition)) (i 0) char mods) | 129 (let ((len (length definition)) (i 0) char mods) |
130 (while (< i len) | 130 (while (< i len) |
131 (insert (if (zerop i) ?\[ ?\s)) | 131 (insert (if (zerop i) ?\[ ?\s)) |
132 (setq char (aref definition i) | 132 (setq char (aref definition i) |
133 i (1+ i)) | 133 i (1+ i)) |
134 (cond ((not (numberp char)) | 134 (if (not (numberp char)) |
135 (prin1 char (current-buffer))) | 135 (prin1 char (current-buffer)) |
136 (t | 136 (princ (prin1-char char) (current-buffer)))) |
137 (insert "?") | |
138 (setq mods (event-modifiers char) | |
139 char (event-basic-type char)) | |
140 (while mods | |
141 (cond ((eq (car mods) 'control) | |
142 (insert "\\C-")) | |
143 ((eq (car mods) 'meta) | |
144 (insert "\\M-")) | |
145 ((eq (car mods) 'hyper) | |
146 (insert "\\H-")) | |
147 ((eq (car mods) 'super) | |
148 (insert "\\s-")) | |
149 ((eq (car mods) 'alt) | |
150 (insert "\\A-")) | |
151 ((and (eq (car mods) 'shift) | |
152 (>= char ?a) | |
153 (<= char ?z)) | |
154 (setq char (upcase char))) | |
155 ((eq (car mods) 'shift) | |
156 (insert "\\S-"))) | |
157 (setq mods (cdr mods))) | |
158 (cond ((= char ?\\) | |
159 (insert "\\\\")) | |
160 ((= char ?\") | |
161 (insert "\\\"")) | |
162 ((= char ?\;) | |
163 (insert "\\;")) | |
164 ((= char 127) | |
165 (insert "\\C-?")) | |
166 ((< char 127) | |
167 (insert char)) | |
168 (t (insert "\\" (format "%o" char))))))) | |
169 (insert ?\])) | 137 (insert ?\])) |
170 (prin1 definition (current-buffer)))) | 138 (prin1 definition (current-buffer)))) |
171 (insert ")\n") | 139 (insert ")\n") |
172 (if keys | 140 (if keys |
173 (let ((keys (where-is-internal macroname '(keymap)))) | 141 (let ((keys (where-is-internal macroname '(keymap)))) |