# Consistent way to represent key sequences? [duplicate]

The macro kbd doesn't work for all desired input. For example, this results in an error:

(kbd "C-H-left")
edmacro-parse-keys: C-H- must prefix a single character, not left


and should be written as:

(kbd "C-H-<left>")


There is an alternative (vector) syntax:

[?\C-\H-x home]


but this representation also isn't unique: the vector above has the same meaning as

[(control hyper x) home]


Also, (kbd "RET") isn't [return], but ?\C-m. Same with (kbd "DEL") and others.

Forms (kbd "\e\eq") and [?\e \?M-q] represent the same key sequence, but have different values:

(kbd "\e\eq")  ; evaluated to "^[^[q"

[?\e \?M-q]    ; evaluated to [27 134217841]


Are all these syntax rules available in Emacs >= v22.x?

Which syntax is consistent and regular? Which mini-language describing key sequences has fewer special cases?

I found that I need to consult references every time I make a new key binding. Consider binding ESC M-H-kp-2 C-PgUp or similar.

## marked as duplicate by Kaushal Modi, Community♦Feb 12 '16 at 19:36

• Why should I care of difference between \r and RET or <RET> or [return]?? – gavenkoa Feb 12 '16 at 18:34