Function: interactive-p

Return t if the containing function was run directly by user input.
This means that the function was called with `call-interactively'
(which includes being called as the binding of a key)
and input is currently coming from the keyboard (not a keyboard macro),
and Emacs is not running in batch mode (`noninteractive' is nil).

The only known proper use of `interactive-p' is in deciding whether to
display a helpful message, or how to display it. If you're thinking
of using it for any other purpose, it is quite likely that you're
making a mistake. Think: what do you want to do when the command is
called from a keyboard macro?

To test whether your function was called with `call-interactively',
either (i) add an extra optional argument and give it an `interactive'
spec that specifies non-nil unconditionally (such as "p"); or (ii) use `called-interactively-p'. (fn)