Function: trace-function

trace-function is a function alias and interactive for trace-function-foreground, defined in trace.el.gz.

Signature

(trace-function FUNCTION &optional BUFFER CONTEXT)

Documentation

Trace calls to function FUNCTION.

With a prefix argument, also prompt for the trace buffer (default trace-buffer), and a Lisp expression CONTEXT. When called from Lisp, CONTEXT should be a function of no arguments which returns a value to insert into BUFFER during the trace.

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.

Probably introduced at or before Emacs version 24.4.

Key Bindings

Aliases

trace-function