emacs-devel
[Top][All Lists]
Advanced

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

Re: trunk defadvice doesn't preserve original function


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

>>>>> Katsumi Yamaoka wrote:

> Performing (defadvice foo ...) twice breaks `foo' if bytecomp
> has been loaded.

I found that the cause is:

2007-10-20  Juanma Barranquero  <address@hidden>

        * doc.c (Fdocumentation): Check for advice in all cases.

This made `ad-real-documentation' (i.e. #<subr documentation>)
return the return value of `ad-make-advised-docstring', while it
was that of `ad-make-advised-definition-docstring' before.
Because of this change, the return value of
`ad-real-documentation' does not have the `ad-advice-info' text
property now, and `ad-advised-definition-p' returns nil even for
an advised function.  This is why `defadvice' always behaves as
is used for the first time for a function.  Here is a patch:

2007-10-23  Katsumi Yamaoka  <address@hidden>

        * emacs-lisp/advice.el (ad-make-advised-docstring): Add
        ad-advice-info text property to doc string.

*** advice.el~  Tue Oct 16 07:45:57 2007
--- advice.el   Tue Oct 23 06:06:00 2007
***************
*** 3004,3011 ****
        (if advice-docstring
            (push advice-docstring paragraphs))))
      (setq origdoc (if paragraphs
!                     ;; separate paragraphs with blank lines:
!                     (mapconcat 'identity (nreverse paragraphs) "\n\n")))
      (help-add-fundoc-usage origdoc usage)))
  
  (defun ad-make-plain-docstring (function)
--- 3004,3013 ----
        (if advice-docstring
            (push advice-docstring paragraphs))))
      (setq origdoc (if paragraphs
!                     (propertize
!                      ;; separate paragraphs with blank lines:
!                      (mapconcat 'identity (nreverse paragraphs) "\n\n")
!                      'ad-advice-info function)))
      (help-add-fundoc-usage origdoc usage)))
  
  (defun ad-make-plain-docstring (function)




reply via email to

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