changeset 10153:2279074cd821

(insert-kbd-macro): Specially handle C-\, M-\ and C-M-\. Only convert the character syntax if definition is a string.
author Richard M. Stallman <rms@gnu.org>
date Tue, 13 Dec 1994 18:47:37 +0000
parents 030853f9aa93
children a864b7f97b56
files lisp/macros.el
diffstat 1 files changed, 41 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/macros.el	Tue Dec 13 14:49:17 1994 +0000
+++ b/lisp/macros.el	Tue Dec 13 18:47:37 1994 +0000
@@ -74,37 +74,47 @@
       (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))))