diff options
| author | Karl Heuer | 1995-03-31 18:52:51 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-03-31 18:52:51 +0000 |
| commit | 157d78ece6255d89943e05f5c59cfb18cc4d11c6 (patch) | |
| tree | ecf462d543f3bf5214669aa91bd7b3cb96169d0e | |
| parent | 5add3885ddaa0d67122703fde2644c3478259d5d (diff) | |
| download | emacs-157d78ece6255d89943e05f5c59cfb18cc4d11c6.tar.gz emacs-157d78ece6255d89943e05f5c59cfb18cc4d11c6.zip | |
(insert-kbd-macro): Do something reasonable for vectors.
| -rw-r--r-- | lisp/macros.el | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/lisp/macros.el b/lisp/macros.el index ca588fa995f..0fe325aadd3 100644 --- a/lisp/macros.el +++ b/lisp/macros.el | |||
| @@ -70,11 +70,11 @@ use this command, and then save the file." | |||
| 70 | (insert "(fset '")) | 70 | (insert "(fset '")) |
| 71 | (prin1 macroname (current-buffer)) | 71 | (prin1 macroname (current-buffer)) |
| 72 | (insert "\n ") | 72 | (insert "\n ") |
| 73 | (let ((beg (point)) end) | 73 | (if (stringp definition) |
| 74 | (prin1 definition (current-buffer)) | 74 | (let ((beg (point)) end) |
| 75 | (setq end (point-marker)) | 75 | (prin1 definition (current-buffer)) |
| 76 | (goto-char beg) | 76 | (setq end (point-marker)) |
| 77 | (if (stringp definition) | 77 | (goto-char beg) |
| 78 | (while (< (point) end) | 78 | (while (< (point) end) |
| 79 | (let ((char (following-char))) | 79 | (let ((char (following-char))) |
| 80 | (cond ((= char 0) | 80 | (cond ((= char 0) |
| @@ -114,7 +114,43 @@ use this command, and then save the file." | |||
| 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) | ||
| 119 | (let ((len (length definition)) (i 0) char) | ||
| 120 | (while (< i len) | ||
| 121 | (insert (if (zerop i) ?\[ ?\ )) | ||
| 122 | (setq char (aref definition i) | ||
| 123 | i (1+ i)) | ||
| 124 | (cond ((not (and (wholenump char) (< char 256))) | ||
| 125 | (prin1 char (current-buffer))) | ||
| 126 | ((= char 0) | ||
| 127 | (insert "?\\C-@")) | ||
| 128 | ((< char 27) | ||
| 129 | (insert "?\\C-" (+ 96 char))) | ||
| 130 | ((= char ?\C-\\) | ||
| 131 | (insert "?\\C-\\\\")) | ||
| 132 | ((< char 32) | ||
| 133 | (insert "?\\C-" (+ 64 char))) | ||
| 134 | ((< char 127) | ||
| 135 | (insert ?? char)) | ||
| 136 | ((= char 127) | ||
| 137 | (insert "?\\C-?")) | ||
| 138 | ((= char 128) | ||
| 139 | (insert "?\\M-\\C-@")) | ||
| 140 | ((= char (aref "\M-\C-\\" 0)) | ||
| 141 | (insert "?\\M-\\C-\\\\")) | ||
| 142 | ((< char 155) | ||
| 143 | (insert "?\\M-\\C-" (- char 32))) | ||
| 144 | ((< char 160) | ||
| 145 | (insert "?\\M-\\C-" (- char 64))) | ||
| 146 | ((= char (aref "\M-\\" 0)) | ||
| 147 | (insert "?\\M-\\\\")) | ||
| 148 | ((< char 255) | ||
| 149 | (insert "?\\M-" (- char 128))) | ||
| 150 | ((= char 255) | ||
| 151 | (insert "?\\M-\\C-?")))) | ||
| 152 | (insert ?\])) | ||
| 153 | (prin1 definition (current-buffer)))) | ||
| 118 | (insert ")\n") | 154 | (insert ")\n") |
| 119 | (if keys | 155 | (if keys |
| 120 | (let ((keys (where-is-internal macroname '(keymap)))) | 156 | (let ((keys (where-is-internal macroname '(keymap)))) |