I have a usecase for this-command
and last-command
, because I'd like a double invocation of a command to behave differently (it's an indenter, FWIW).
Some manual interactive experiments suggest that invoking commands manually with M-x
or key combinations set the this-command
and cycle last-command
, which can sometimes get confusing if the command has any kill-*
behaviour in it. This is as expected.
However, when called from my ert tests, even if I invoke functions with run-interactively
, this-command
remains nil
.
How can I make my scripted ert tests invoke commands so that this-command
/ last-command
behave the same as when the user is entering those commands?