Variable: post-command-hook

post-command-hook is a variable defined in keyboard.c.

Documentation

Normal hook run after each command is executed.

If an unhandled error happens in running this hook, the function in which the error occurred is unconditionally removed, since otherwise the error might happen repeatedly and make Emacs nonfunctional.

It is a bad idea to use this hook for expensive processing. If unavoidable, wrap your code in (while-no-input (redisplay) CODE) to avoid making Emacs unresponsive while the user types.

See also pre-command-hook.

Probably introduced at or before Emacs version 19.20.

Source Code

// Defined in /usr/src/emacs/src/keyboard.c
  DEFVAR_LISP ("post-command-hook", Vpost_command_hook,
	       doc: /* Normal hook run after each command is executed.
If an unhandled error happens in running this hook,
the function in which the error occurred is unconditionally removed, since
otherwise the error might happen repeatedly and make Emacs nonfunctional.

It is a bad idea to use this hook for expensive processing.  If
unavoidable, wrap your code in `(while-no-input (redisplay) CODE)' to
avoid making Emacs unresponsive while the user types.

See also `pre-command-hook'.  */);