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

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

Tool for ELISP code analysis


From: Marc Tfardy
Subject: Tool for ELISP code analysis
Date: Mon, 05 Mar 2007 13:21:11 +0100
User-agent: Thunderbird 1.5.0.10 (Windows/20070221)

Hi!

I try to understand some (complicated) ELISP code with many lines of
code and many functions.  It is not easy to keep overview of the
function calls and dependecies between functions/variables.  Is there
maybe a Emacs tool for ELISP code analysis?  It should idicate all
disired functions and variables (specified with regexp, like
e.g. "bla-*") with list of all function/variables called/referenced
from this function. Some example - assume we have following code:

-file: bla.el-----------------------------------------------------------
(defvar bla-max-iter 100)

(defun bla-foo ()
  (let ((i 0))
    (while (< i bla-max-iter)
      (bla-big-job i)
      (incf i)))

(defun bla-goo (text)
  (message "[BLA] %s" text))

(defun bla-big-job (num)
  (unimportant-code)
  (more-unimportant-code)
  (bla-do-nothing)
  (bla-do-something))

(defun bla-do-nothing ()
  (long-unimportant-code)
  (setq bla-min 0)
  (setq bla-max 10))

(defun bla-do-something ()
  (strange-code)
  (bla-antoher-fun 1 2 3 4)
  (bla-secret-fun 0))

(defun bla-another-fun (v1 v2 v3 v4)
  (+ v1 v2 v3 v4))

(defun bla-secret-fun (n)
  (message "MAGIC!"))
-file: bla.el ends here-------------------------------------------------


Now we start analyse tool for whole code in buffer bla.el. We look
only for bla-stuff:

M-x elisp-analyse RET bla-*

and we should get something like this:



VAR: bla-max-iter

FUN: bla-foo:
     --> bla-max-iter (VAR)
     --> bla-big-job (FUN)

FUN: bla-goo:

FUN: bla-big-job:
     --> bla-do-nothing (FUN)
     --> bla-do-something (FUN)

FUN: bla-do-nothing:
     --> bla-min (VAR)
     --> bla-max (VAR)

FUN: bla-do-something:
     --> bla-antoher-fun (FUN)
     --> bla-secret-fun (FUN)

FUN: bla-another-fun:

FUN: bla-secret-fun:

Note: we get *ONLY* functions and variables with "bla-"-Prefix, due
to elisp-analyse call with bla-*.


The function and variable names in this list could be linked to
definitions in bla.el, so a click with mouse or RET on such
a name jumps directly to properly line (in other window with bla.el).

Does exists already such a tool?

regards

Marc




reply via email to

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