[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Catching redefinitions
From: |
Elena |
Subject: |
Catching redefinitions |
Date: |
Fri, 26 Nov 2010 06:09:58 -0800 (PST) |
User-agent: |
G2/1.0 |
Hello,
some time ago, I asked about catching functions redefinitions for
troubleshooting both .emacs and third-party packages. Thanks to those
who answered, I've been able to write some code to accomplish such
goal. Here it is:
(defadvice defun (before redefinition-warning (name arglist docstring
&rest body) activate)
"Checks whether `name' has already been defined as
function.
If so, output debugging information to a dedicated
buffer."
(let ((name (ad-get-arg 0)))
;; We are only looking for redefinition happening into
loaded
files,
;; since users must be allowed to redefine functions
interactively.
(when (and load-file-name
(fboundp name))
(with-current-buffer (get-buffer-create
"*Redefinitions*")
(insert (format "
FUNCTION: %s
ORIGINAL FILE: %s
REDEFINITION FILE: %s"
name
(find-lisp-object-file-name name (symbol-function name))
(abbreviate-file-name load-file-name)))))))
This advice works, but it chokes on `define-slime-contrib'. Can
anyone check it? Thanks.
- Catching redefinitions,
Elena <=