Subject: bug#27397: [PATCH] New commands for bulk tracing of elisp functions

From: Phil Sainty <[email-masked]>
Date: Sat, 17 Jun 2017 21:20:00 +1200

Thanks to the merge with
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=1343 and
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=6464 I see that there
was a previous submission of a `trace-package' command which (a) used
foreground tracing, and (b) provided `trace-package-background' as a
separate command.

I should note that I elected not to support foreground tracing for
my proposed commands, simply because it seemed to me that foreground
tracing could be problematic in too many cases, when the traces are
being applied en masse on the basis of function name pattern matching.

The current `trace-function-foreground' docstring says:

> 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.

My compromise was to indicate the `trace-buffer' value in the echo
area when the commands are invoked, so that the user would know where
the trace output was happening.  Actually popping up that buffer when
the `trace-package' or `trace-regexp' command is used would be another
(perhaps nicer) option?

I'm open to recommendations for the most useful approach.

Do others think that foreground versions of these commands would be
a good idea?

A prefix argument could mean "use foreground tracing", but that's
inconsistent with `trace--read-args' which uses a prefix arg to prompt
the user for the trace buffer and a context expression -- which I now
realise is behaviour that my commands should incorporate as well.

-Phil