[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there a way to convert a keyboard macro to a string?
From: |
Stefan Monnier |
Subject: |
Re: Is there a way to convert a keyboard macro to a string? |
Date: |
Wed, 26 Jul 2017 09:13:40 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
> execute-kbd-macro accepts a string as MACRO. However, if I record
> a macro using F3 ... F4 and look at last-kbd-macro, it is a vector and
> not a string. How do I convert it to a string representing the same key
> sequence?
Depending on the purpose, you can do:
(seq-into VEC 'string)
or
(key-description VEC)
The first will fail if your key sequence includes non-character events,
or events with non-trivial modifiers. The second will give you a string
that's human readable but needs to be passed through `kbd` before it can
be used as a "key sequence" (e.g. for define-key).
Stefan
Re: Is there a way to convert a keyboard macro to a string?, Marcin Borkowski, 2017/07/26