I do this in pre-command-hook and I just did forget that this-command still
will be carried out (and that was what I wanted to prevent). I think this is
what I should do instead:
(setq this-command 'tunnel-last-command)
(setq unread-command-events
(append unread-command-events
(listify-key-sequence
(this-command-keys-vector))
nil))
(defun tunnel-last-command ()
"Set `this-command' to `last-command'."
(interactive)
(setq this-command last-command))
This works for in the tests I have made (including some with Viper undo
involved). If this is the way to do such things in pre-command-hook then
this might be worth documenting.
You seem to be thinking out loud. I don't know what you mean by "such
things".