2

I did some editing. Then went to C-x C-k l edited the stuff to suit my needs. Saved it with C-c C-c. Gave it a name with C-x C-k b. Finally, went to ~/.emacs and did M-x insert-kbd-macro

To my surprise, it produced few words and a long series of numbers. I can still execute it using M-x macroname RET and edit it using C-x C-k e. So no problems.

But why those cryptic numbers in ~/.emacs?

2

Keyboard macros record keystrokes (or keyboard events), which typically (although not exclusively) have a numeric representation.

Many directly represent characters, as characters are integers in Emacs Lisp. e.g. The character t is 116:

ELISP> ?t
116 (#o164, #x74, ?t)

(Characters are therefore likely to account for all the smaller numbers.)

Larger numbers can represent more complex key events. e.g.:

ELISP> (listify-key-sequence (kbd "M-x"))
(134217848)

A few events may have non-numeric representations (e.g. return).

You can read all about events in the manual:

C-hig (elisp) Input Events RET

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.