[Top][All Lists]

[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, 19 Jun 2017 14:05:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Phil Sainty <address@hidden> writes:

> I think `trace-library' would be the appropriate name?

As usual, I don't care too much about function names :-)

> Of course we can't guarantee that library foo.el adheres to a foo-*
> naming scheme for all its functions (or that other libraries don't
> define any foo-* functions). Would we just ignore this and trace
> everything starting with foo- on the assumption that this is good
> enough? Or would we parse the library in order to trace that library's
> functions precisely?

We cannot assume that library 'foo prefixes all its functions with
"foo-". Even Tramp libraries have functions which do not fit this
scheme, for historical reasons.

So we shall parse indead every function for the library it belongs to. It
shouldn't be too hard, based on `autoloadp', `find-lisp-object-file-name'
and friends, see the implementation in `describe-function-1'. Something
like this is a very rudimentary implementation:

(defun my-find-library (fun)
  "Find library FUN is defined in.
In case of subroutines, return t"
  (when (fboundp fun)
    (let ((def (symbol-function fun)))
       ((autoloadp def) (cadr def))
       ((subrp def) t)
       (t (file-name-base (find-lisp-object-file-name fun nil)))))))

> -Phil

Best regards, Michael.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]