unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Tool for ELISP code analysis
@ 2007-03-05 12:21 Marc Tfardy
  2007-03-06  0:37 ` Johan Bockgård
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Tfardy @ 2007-03-05 12:21 UTC (permalink / raw)
  To: help-gnu-emacs

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-03-06 22:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-05 12:21 Tool for ELISP code analysis Marc Tfardy
2007-03-06  0:37 ` Johan Bockgård
2007-03-06 22:30   ` Marc Tfardy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).