diff options
| author | Richard M. Stallman | 1995-08-22 16:47:19 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1995-08-22 16:47:19 +0000 |
| commit | 07d1e73a74af58d199a89e57d6094c80dca4f799 (patch) | |
| tree | 359e1852802d3e42e09fb060c6df4a851fe70a3c | |
| parent | 3068998dc3983c6eb64ddfcfbbf1fc71388865ee (diff) | |
| download | emacs-07d1e73a74af58d199a89e57d6094c80dca4f799.tar.gz emacs-07d1e73a74af58d199a89e57d6094c80dca4f799.zip | |
(insert-kbd-macro): Express vector char modifiers with
escape prefixes. Express big basic char codes in octal.
| -rw-r--r-- | lisp/macros.el | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/lisp/macros.el b/lisp/macros.el index a8f9648af7f..d834dca8806 100644 --- a/lisp/macros.el +++ b/lisp/macros.el | |||
| @@ -116,39 +116,42 @@ use this command, and then save the file." | |||
| 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") |