read-kbd-macroin more detail?
read-kbd-macro function returns the internal Emacs
representation of a human-readable string (which is its argument).
(read-kbd-macro "C-c C-a") ⇒ [(control ?c) (control ?a)] (read-kbd-macro "C-c C-. <up>") ⇒ [(control ?c) (control ?.) up]
In GNU Emacs the same forms will be evaluated to what GNU Emacs
understands internally—the sequences
67108910 up], respectively.
The exact human-readable syntax is defined in the docstring of
edmacro-mode. I’ll repeat it here, for completeness.
Format of keyboard macros during editing:
Text is divided into words separated by whitespace. Except for the words described below, the characters of each word go directly as characters of the macro. The whitespace that separates words is ignored. Whitespace in the macro must be written explicitly, as in foo SPC bar RET.
- The special words RET, SPC, TAB, DEL, LFD, ESC, and NUL represent special control characters. The words must be written in uppercase.
- A word in angle brackets, e.g.,
<f1>, represents a function key. (Note that in the standard configuration, the function key
<return>and the control key RET are synonymous.) You can use angle brackets on the words RET, SPC, etc., but they are not required there.
- Keys can be written by their ASCII code, using a backslash followed by up to six octal digits. This is the only way to represent keys with codes above \377.
- One or more prefixes M- (meta), C- (control), S- (shift), A- (alt), H- (hyper), and s- (super) may precede a character or key notation. For function keys, the prefixes may go inside or outside of the brackets:
<C-down>. The prefixes may be written in any order: M-C-x ≡ C-M-x.
Prefixes are not allowed on multi-key words, e.g., C-abc, except that the Meta prefix is allowed on a sequence of digits and optional minus sign: M--123 ≡ M-- M-1 M-2 M-3.
^notation for control characters also works: ^M ≡ C-m.
- Double angle brackets enclose command names:
<<next-line>>is shorthand for M-x next-line RET.
;;causes the rest of the line to be ignored as a comment.
Any word may be prefixed by a multiplier in the form of a decimal number and
<right> <right> <right>, and
Multiple text keys can normally be strung together to form a word, but you may need to add whitespace if the word would look like one of the above notations:
; ; ;is a keyboard macro with three semicolons, but
;;;is a comment. Likewise,
\ 1 2 3is four keys but
\123is a single key written in octal, and
< right >is seven keys but
<right>is a single function key. When in doubt, use whitespace.