Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In post-command-hook, this-command for kill-word has turned into kill-region somehow

Tags:

emacs

elisp

In my post-command-hook callback, when I do kill-word, the this-command var is kill-region - and not kill-word as expected.

I guess that's because kill-word uses kill-region, but knowing exactly which command was used is essential to my script. Any way to get at that information somehow?

Thanks

like image 621
Magnar Avatar asked Jan 24 '12 08:01

Magnar


1 Answers

Turns out all the kill-commands change this-command to kill-region so they can interoperate on appending things to the kill ring. To get to the actual command, emacs has this-original-command - which is not modified.

like image 130
Magnar Avatar answered Oct 23 '22 05:10

Magnar