From f0653de7749c27b8fe6c92c7c72c75ae493b8e73 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 13 Dec 1994 18:47:37 +0000 Subject: (insert-kbd-macro): Specially handle C-\, M-\ and C-M-\. Only convert the character syntax if definition is a string. --- lisp/macros.el | 72 +++++++++++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 31 deletions(-) (limited to 'lisp/macros.el') diff --git a/lisp/macros.el b/lisp/macros.el index afae6e44500..ca588fa995f 100644 --- a/lisp/macros.el +++ b/lisp/macros.el @@ -74,37 +74,47 @@ use this command, and then save the file." (prin1 definition (current-buffer)) (setq end (point-marker)) (goto-char beg) - (while (< (point) end) - (let ((char (following-char))) - (cond ((= char 0) - (delete-region (point) (1+ (point))) - (insert "\\C-@")) - ((< char 27) - (delete-region (point) (1+ (point))) - (insert "\\C-" (+ 96 char))) - ((< char 32) - (delete-region (point) (1+ (point))) - (insert "\\C-" (+ 64 char))) - ((< char 127) - (forward-char 1)) - ((= char 127) - (delete-region (point) (1+ (point))) - (insert "\\C-?")) - ((= char 128) - (delete-region (point) (1+ (point))) - (insert "\\M-\\C-@")) - ((< char 155) - (delete-region (point) (1+ (point))) - (insert "\\M-\\C-" (- char 32))) - ((< char 160) - (delete-region (point) (1+ (point))) - (insert "\\M-\\C-" (- char 64))) - ((< char 255) - (delete-region (point) (1+ (point))) - (insert "\\M-" (- char 128))) - ((= char 255) - (delete-region (point) (1+ (point))) - (insert "\\M-\\C-?")))))) + (if (stringp definition) + (while (< (point) end) + (let ((char (following-char))) + (cond ((= char 0) + (delete-region (point) (1+ (point))) + (insert "\\C-@")) + ((< char 27) + (delete-region (point) (1+ (point))) + (insert "\\C-" (+ 96 char))) + ((= char ?\C-\\) + (delete-region (point) (1+ (point))) + (insert "\\C-\\\\")) + ((< char 32) + (delete-region (point) (1+ (point))) + (insert "\\C-" (+ 64 char))) + ((< char 127) + (forward-char 1)) + ((= char 127) + (delete-region (point) (1+ (point))) + (insert "\\C-?")) + ((= char 128) + (delete-region (point) (1+ (point))) + (insert "\\M-\\C-@")) + ((= char (aref "\M-\C-\\" 0)) + (delete-region (point) (1+ (point))) + (insert "\\M-\\C-\\\\")) + ((< char 155) + (delete-region (point) (1+ (point))) + (insert "\\M-\\C-" (- char 32))) + ((< char 160) + (delete-region (point) (1+ (point))) + (insert "\\M-\\C-" (- char 64))) + ((= char (aref "\M-\\" 0)) + (delete-region (point) (1+ (point))) + (insert "\\M-\\\\")) + ((< char 255) + (delete-region (point) (1+ (point))) + (insert "\\M-" (- char 128))) + ((= char 255) + (delete-region (point) (1+ (point))) + (insert "\\M-\\C-?"))))))) (insert ")\n") (if keys (let ((keys (where-is-internal macroname '(keymap)))) -- cgit v1.2.1