[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Clarify documentation for magic activation of advice
From: |
Markus Rost |
Subject: |
Clarify documentation for magic activation of advice |
Date: |
Fri, 4 Jul 2003 01:44:02 -0400 (EDT) |
The file advice.el calls (ad-start-advice) at the very end. I suggest
to document this. The current documentation
(Info-goto-node "(elisp)Activation of Advice")
indicates that (ad-start-advice) is not called by default. Here is an
experiment with somewhat surprising results, at least after reading
the current documentation.
(progn
(defadvice foo (around return-t) "Return t." (setq ad-return-value t))
(defun foo nil "Return nil." nil)
(foo))
==> t
(progn
(defun foo1 nil "Return nil." nil)
(defadvice foo1 (around return-t) "Return t." (setq ad-return-value t))
(foo1))
==> nil
==> t (if you repeat the evaluation)
And here is a suggestion for the documentation.
* advice.texi (Activation of Advice): Note that ad-start-advice
is turned on by default.
===Buffer *vc-diff*=========================================
*** advice.texi.~1.15~ Tue Jun 24 14:34:23 2003
--- advice.texi Wed Jul 2 15:26:31 2003
***************
*** 331,337 ****
@cindex advice, activating
By default, advice does not take effect when you define it---only when
! you @dfn{activate} advice for the function that was advised. You can
request the activation of advice for a function when you define the
advice, by specifying the @code{activate} flag in the @code{defadvice}.
But normally you activate the advice for a function by calling the
--- 331,339 ----
@cindex advice, activating
By default, advice does not take effect when you define it---only when
! you @dfn{activate} advice for the function that was advised. However
! the advice will be automatically activated when the function is
! defined or redefined later. You can
request the activation of advice for a function when you define the
advice, by specifying the @code{activate} flag in the @code{defadvice}.
But normally you activate the advice for a function by calling the
***************
*** 416,423 ****
@deffn Command ad-start-advice
Turn on automatic advice activation when a function is defined or
! redefined. If you turn on this mode, then advice takes effect
! immediately when defined.
@end deffn
@deffn Command ad-stop-advice
--- 418,424 ----
@deffn Command ad-start-advice
Turn on automatic advice activation when a function is defined or
! redefined. This mode is turned on by default.
@end deffn
@deffn Command ad-stop-advice
============================================================
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Clarify documentation for magic activation of advice,
Markus Rost <=