So, I was looking for a way to save Emacs macros as elisp code - a submenu of the Emacs keyword description language used by 'insert-kbd-macro for the actual functions mapped to macro keys.
At the same time, I first looked for functions associated with keys, and then provided these functions in the form of strings that should be written to the current buffer
(symbol-name (key-binding "\C-xo"))
Will return the string "other-window"
However, insert-kbd-macro currently saves macros in carriage notation (and not in a human-friendly form) (for example: ^P vs \Cp ) The key-binding function seems to accept only humanoid notation.
Therefore, in order to convert into a human-readable notation, I looked at the key-description function
(key-description "\346")
returns "Mf"
However, in order to be accepted key-binding , it requires a notation in the form of `` \ Mf ")
The obvious way to do this would be
(concat "\\" (key-description "\346")
However, emacs only ever returns "\\" not "\"
To find out what is going on, I decided to see how the original byte for the character "\" displayed as ...
(byte-to-string 92)
it returns '\\'
I suspect this may be a bug in elisp.
jones source share