[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#27397: [PATCH] New commands for bulk tracing of elisp functions
From: |
Michael Albinus |
Subject: |
bug#27397: [PATCH] New commands for bulk tracing of elisp functions |
Date: |
Mon, 12 Sep 2022 15:26:32 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Lars Ingebrigtsen <larsi@gnus.org> writes:
Hi,
> I have not tried the patch myself -- does anybody have any comments
> here? It seems like useful functionality to me.
Yes, and I also agree with the comments of Eli.
One additional point:
> +@deffn Command trace-package prefix &optional buffer context after-load
> +This function calls @code{trace-function-background} for all functions
> +with names starting with @var{prefix}.
Tramp does something like this already. However, not all Tramp functions
shall be traced. For example, there is `tramp-read-passwd', which
returns the password retireved from auth-sources, or
interactively. Obviously, it shouldn't be traced when asking users for a
Tramp trace.
There are also chatty functions, which don't need to be traces, like
`tramp-message' and friends. They add serious noise to the trace, w/o
additional information.
For that reason, Tramp marks such functions with a function property,
which is to be taken into account when activating traces for all Tramp
functions. Like this:
--8<---------------cut here---------------start------------->8---
(put #'tramp-read-passwd 'tramp-suppress-trace t)
--8<---------------cut here---------------end--------------->8---
I would appreciate if `trace-package' and `trace-library' would know a
similar mechanism. It could be a function declaration in the function
definition, like
--8<---------------cut here---------------start------------->8---
(declare (debug t) inhibit-trace ...)
--8<---------------cut here---------------end--------------->8---
Or, dynamically, the global variable inhibit-trace could keep a value of
such functions suppressed for trace.
Of course there is `untrace-function', but it is inconvenient to teach
users calling all of them. And if they forget it, their password will be
exposed (for example).
> +;;;###autoload
> +(defun trace-library (library &optional buffer context after-load)
> + "Trace functions defined by LIBRARY.
> +For example, to trace tramp.el functions, you could use:
> +
> +\\[trace-library] RET tramp RET
I wouldn't use `tramp' as example for `trace-library'. Tramp consists of
a dozen of libraries, and several of them must be activated in order to
get useful traces. So as example, another library might be better
suited.
Best regards, Michael.