How can I convert an emacs keysequence vector (ie the result of read-key-sequence-vector) into a user readable string? I.e., given [7], return 'C-g'.
I need a reliable way of checking for equality among key sequences of arbitrary length, as well as of displaying the key sequences in a non-vector format (ie human-readable).
For detail, my function must do the following:
There are two functions I can use, read-key-sequence and read-key-sequence-vector. The former returns sometimes as string, sometimes as vector, the user's typed keysequence. For example, sometimes it returns "1", but sometimes, [49], for the key 'one'. This unpredictable behavior does not allow me to test for equality.
The latter returns the keys as a vector, which as I mentioned is not useful to me because I need the user to see the possible keysequences.
I suppose I can manually create a hasmap of all keys on my current machine's keyboard. But I am afraid this is not portable to other machines.
(key-description [7]) => "C-g"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With