emacs-devel
[Top][All Lists]
Advanced

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

trunk defadvice doesn't preserve original function


From: Katsumi Yamaoka
Subject: trunk defadvice doesn't preserve original function
Date: Mon, 22 Oct 2007 12:02:31 +0900
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux)

Hi,

Performing (defadvice foo ...) twice breaks `foo' if bytecomp
has been loaded.  You can reproduce this with `emacs -Q' as
follows:

(require 'bytecomp)

(defun foo ()
  "foo")

(symbol-function 'foo)
 => (lambda nil "foo")

(defadvice foo (around testing activate)
  (setq ad-return-value (concat ad-do-it "+bar")))

(symbol-function 'foo)
 => #[nil "\301^X\302 \211^P\303P\211^P)\207"
      [ad-return-value nil ad-Orig-foo "+bar"]
      3 #("Advice doc string" 0 17 (ad-advice-info foo))]
(symbol-function 'ad-Orig-foo)
 => (lambda nil "foo")

(defadvice foo (around testing activate)
  (setq ad-return-value (concat ad-do-it "+bar")))

(symbol-function 'foo)
 => #[nil "\301^X\302 \211^P\303P\211^P)\207"
      [ad-return-value nil ad-Orig-foo "+bar"]
      3 #("Advice doc string" 0 17 (ad-advice-info foo))]
(symbol-function 'ad-Orig-foo)
 => #[nil "\301^X\302 \211^P\303P\211^P)\207"
      [ad-return-value nil ad-Orig-foo "+bar"]
      3 #("Advice doc string" 0 17 (ad-advice-info foo))]

That is, `ad-Orig-foo' calls `ad-Orig-foo' itself.  Because of
this, re-loading ~/.emacs file containing defadvice forms causes
the ``Lisp nesting exceeds `max-lisp-eval-depth'' error.

I don't know what's going on in the trunk but Unicode-2 has no
such problem.

Regards,




reply via email to

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