How to convert an emacs keysequence sequence vector (i.e. the result of a read sequence vector) into a user-readable string? Ie, given [7], return 'C-g'.
I need a reliable way to check the equality between key sequences of arbitrary length, as well as display key sequences in a non-vector format (i.e. for human reading).
For details, my function should do the following:
- Define hashmap key sequences for values (strings). Key sequences have arbitrary lengths (for example, "q" "w" 3 "4") and are not limited to emacs layouts.
- Display mappings (keysequence → string) to the user in the buffer. Therefore, keywords must be understandable to the user, that is, they cannot be in vector format.
- Read the key sequence from the user, return the corresponding line.
There are two functions that I can use, read-key sequence and code-sequence-sequence-sequence. The first returns sometimes as a string, sometimes as a vector, the user entered a key sequence. For example, sometimes it returns “1”, but sometimes, [49], for the key is “one”. This unpredictable behavior does not allow me to verify equality.
The latter returns the keys as a vector, which, as I mentioned, will not be useful to me, because I need a user to see possible key sequences.
, hasmap . , .