[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to get keyboard macro that was just run?
From: |
Okamsn |
Subject: |
Re: How to get keyboard macro that was just run? |
Date: |
Sun, 18 Jun 2023 17:13:29 +0000 |
On 2023-06-18 17:05 UTC, Okamsn wrote:
> On 2023-06-18 15:53 UTC, Eduardo Ochs wrote:
>> Hi Okamsn,
>> try to run this with C-x C-e:
>>
>> (insert (format "\n\%S\n"
>> `(setq last-kbd-macro (kbd ,(format-kbd-macro last-kbd-macro)))))
>>
>> it's roughly the trick that I use to save and edit keyboard macros,
>> but stripped out of all the cruft...
>> Cheers,
>> Eduardo Ochs
>> http://anggtwu.net/#eev
>
> Thank you for the response. I know that the variable `last-kbd-macro`
> contains the last keyboard macro that was defined, but I am interested
> in programmatically knowing the last keyboard macro that was run, just
> after it is run.
>
> For example, `consult-kmacro` selects a keyboard macro from
> `kmacro-ring`, converts that macro to a function, and then runs
> function. In this way, it does not change the value of `last-kbd-macro`,
> as far as I'm aware.
>
>
I realize now that the problem is more complicated than I first thought,
because Meow also uses keyboard macros in other ways, so just advising
`execute-kbd-macro` would affect things indiscriminately.