Function: trace-function-foreground

trace-function-foreground is an autoloaded, interactive and byte-compiled function defined in trace.el.gz.

Signature

(trace-function-foreground 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.

Key Bindings

Aliases

trace-function

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/trace.el.gz
;;;###autoload
(defun trace-function-foreground (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.  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'."
  (interactive (trace--read-args "Trace function"))
  (trace-function-internal function buffer nil context))