In many cases emacs doesn't execute kbd macros exactly as it should be. For example
(execute-kbd-macro (read-kbd-macro "C-x C-f"))
Rather than to end execution of this macros with open minibuffer Find file: ...
emacs just opens the first available file or dired buffer (depending on the situation). How to execute such kinds of kbd macroses without such misunderstandings?
Upd 2. It is just example of such kind of keyboard macroses that behaves differently from the original behavior (i.e. C-x C-f pressed). Below is another example with grep
.
Upd. As @lawlist mentioned I can use
(key-binding (kbd "C-x C-f"))
for transformation key sequence to command name. But it only works when there is the command. In a more complex case, e.g.
(execute-kbd-macro (read-kbd-macro "C-u M-x grep RET"))
this "brute-force" method doesn't work (I want to continue editing pattern for grep
but emacs forcedly finishes the interaction).