]> git.eshelyaron.com Git - emacs.git/commitdiff
(elp-instrument-function): Handle advised
authorGerd Moellmann <gerd@gnu.org>
Thu, 17 May 2001 13:58:14 +0000 (13:58 +0000)
committerGerd Moellmann <gerd@gnu.org>
Thu, 17 May 2001 13:58:14 +0000 (13:58 +0000)
functions.

lisp/ChangeLog
lisp/emacs-lisp/elp.el

index b28f19da1c55786d2c1d626ca87450ee52da5704..1fed7553fa9e53f415f9686267c9e58a5d752b49 100644 (file)
@@ -1,3 +1,8 @@
+2001-05-17  Gerd Moellmann  <gerd@gnu.org>
+
+       * emacs-lisp/elp.el (elp-instrument-function): Handle advised
+       functions.
+
 2001-05-17  Stefan Monnier  <monnier@cs.yale.edu>
 
        * jit-lock.el (jit-lock-after-change): Check the font-lock-multiline
index af189126a0979060ae958d12369a104a5ae501e5..6ecb05b231fc87d147dc9456a03b5a1dc5fb8ee5 100644 (file)
@@ -1,6 +1,6 @@
 ;;; elp.el --- Emacs Lisp Profiler
 
-;; Copyright (C) 1994,1995,1997,1998 Free Software Foundation, Inc.
+;; Copyright (C) 1994,1995,1997,1998, 2001 Free Software Foundation, Inc.
 
 ;; Author:        1994-1998 Barry A. Warsaw
 ;; Maintainer:    FSF
@@ -266,15 +266,22 @@ FUNSYM must be a symbol of a defined function."
     ;; put the info vector on the property list
     (put funsym elp-timer-info-property infovec)
 
-    ;; set the symbol's new profiling function definition to run
-    ;; elp-wrapper
-    (fset funsym newguts)
+    ;; Set the symbol's new profiling function definition to run
+    ;; elp-wrapper.
+    (let ((advice-info (get funsym 'ad-advice-info)))
+      (if advice-info
+         (progn
+           ;; If function is advised, don't let Advice change
+           ;; its definition from under us during the `fset'.
+           (put funsym 'ad-advice-info nil)
+           (fset funsym newguts)
+           (put funsym 'ad-advice-info advice-info))
+       (fset funsym newguts)))
 
     ;; add this function to the instrumentation list
     (or (memq funsym elp-all-instrumented-list)
        (setq elp-all-instrumented-list
-             (cons funsym elp-all-instrumented-list)))
-    ))
+             (cons funsym elp-all-instrumented-list)))))
 
 (defun elp-restore-function (funsym)
   "Restore an instrumented function to its original definition.