Q: how do I get
this-command-key-vector to return a character vector when called with the return key?
Consider the following simple command, which will echo the vector of keys that invoked it:
(defun test-echo () (interactive) (message "%s" (this-command-keys-vector)))
Now let's bind it to two keys:
(local-set-key "i" #'test-echo) (local-set-key [return] #'test-echo)
When typing i, the function correctly messages me with the vector
, which corresponds to i's character representation
(eq ?i 105). However, when typing return, it echoes
[return], when I would have expected
First of all, is this a problem with my understanding of
this-command-key-vector, my understanding of
return, or both? Second of all, how do I get
this-command-key-vector to return a character (ie, the integer value) rather than the symbol
return (or, alternately, how do I translate
return to a character)?