In some cases, I often run the same command, say my-common-fun
, which I call subsequently with M-x M-p RET
, and occasionally run another command, such as my-occasional-fun
. I want to call the latter interactively without adding it to the command-history
, so that M-x M-p RET
runs my-common-fun
.
I tried this:
(defun my-occasional-fun ()
(interactive)
(insert "one occasional shortcut")
(pop command-history))
This fails, probably because the function is added to the command history after it runs.
I tried with an advice:
(defadvice my-occasional-fun (after my-occasional-fun-after activate) (pop command-history))
and it also fails: I see the command my-occasional-fun
in the history.
Can I call a function interactively without adding it to the command history?