unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Marc Tfardy <m-t-o___CUT__IT___@web.de>
To: help-gnu-emacs@gnu.org
Subject: Tool for ELISP code analysis
Date: Mon, 05 Mar 2007 13:21:11 +0100	[thread overview]
Message-ID: <552g9pF235gcoU1@mid.individual.net> (raw)

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	other threads:[~2007-03-05 12:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-05 12:21 Marc Tfardy [this message]
2007-03-06  0:37 ` Tool for ELISP code analysis Johan Bockgård
2007-03-06 22:30   ` Marc Tfardy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=552g9pF235gcoU1@mid.individual.net \
    --to=m-t-o___cut__it___@web.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).