Commit f0653de7 authored by Richard M. Stallman's avatar Richard M. Stallman

(insert-kbd-macro): Specially handle C-\, M-\ and C-M-\.

Only convert the character syntax if definition is a string.
parent b63df577
......@@ -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))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment