bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Phil Sainty
Subject: bug#27397: [PATCH] New commands for bulk tracing of elisp functions
Date: Tue, 20 Jun 2017 00:17:38 +1200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1

On 20/06/17 00:05, Michael Albinus wrote:
> 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)))
>       (cond
>        ((autoloadp def) (cadr def))
>        ((subrp def) t)
>        (t (file-name-base (find-lisp-object-file-name fun nil)))))))

Meanwhile I was experimenting with load-history along these lines:

(require 'seq)
(defun trace-library (library)
  "Trace functions defined by LIBRARY."
  (mapcar 'trace-function-background
          (mapcar 'cdr (seq-filter
                        (lambda (x)
                          (and (consp x) (eq (car x) 'defun)))
                        (load-history-filename-element
                         (load-history-regexp library))))))






reply via email to

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