trace-function

trace-function is an alias for `trace-function-foreground' in `trace.el'.


(trace-function FUNCTION &optional BUFFER CONTEXT)

Trace calls to function FUNCTION.
With a prefix argument, also prompt for the trace buffer (default
`trace-buffer'), and a Lisp expression CONTEXT.

Tracing a function causes every call to that function to insert
into BUFFER Lisp-style trace messages that display the function's
arguments and return values. It also evaluates CONTEXT, if that is
non-nil, and inserts its value too. For example, you can use this
to track the current buffer, or position of point.

This function creates BUFFER if it does not exist. This buffer will
popup whenever FUNCTION is called. Do not use this function to trace
functions that switch buffers, or do any other display-oriented
stuff - use `trace-function-background' instead.

To stop tracing a function, use `untrace-function' or `untrace-all'.