ad-activate. All callers changed, including those in data.c.
(ad-activate-internal-off): Renamed from ad-activate-off.
All uses changed.
(ad-activate): Renamed from ad-activate-on. All uses changed.
(ad-start-advice, ad-stop-advice, ad-recover-normality):
Alter the definition of ad-activate-internal, not ad-activate.
exploits modified built-in versions of `fset' and `defalias' which
take care of this functionality directly:
(ad-start-advice-on-load, ad-activate-on-definition)
(ad-definition-hooks, ad-enable-definition-hooks, ad-defined-function)
(ad-advised-definers, ad-advised-byte-compilers, byte-constant)
(byte-constant-limit, byte-constant2, byte-fset)
(ad-byte-code-fset-regexp): Variables deleted.
(ad-activate-defined-function, ad-find-fset-in-byte-code)
(ad-scan-byte-code-for-fsets, ad-advised-byte-code)
(ad-recover-byte-code, ad-enable-definition-hooks)
(ad-disable-definition-hooks): Functions deleted.
(defun, defmacro, fset, defalias, define-function)
(byte-compile-from-buffer, byte-compile-top-level): Removed `defadvice'
for these functions.
(ad-save-real-definitions): Removed saving of `byte-code'.
(ad-activate-off): New dummy function.
(ad-activate-on): New name for `ad-activate'. All calls changed.
(ad-with-auto-activation-disabled): New macro prevents automatic
advice activation.
(ad-safe-fset): New function, used instead of `ad-real-fset'.
(ad-compile-function): Disable automatic advice activation while
compiling, because `byte-compile' uses `fset'.
(ad-activate-on): Renamed from `ad-activate'. Avoid recursive calls.
(ad-activate-on-top-level): New variable.
(ad-start-advice, ad-stop-advice, ad-recover-normality): Modified to
achieve de/activation of automatic advice activation by setting the
definition of `ad-activate' to `ad-activate-on' or `ad-activate-off'.
(ad-start-advice): Is now called unconditionally when Advice is loaded.
Made compilation behavior of advised definitions customizable, since
loading the byte-compiler takes some time and is not always worth the
cost, e.g., if one only wants to make a few simple modifications:
(ad-default-compilation-action): New variable which specifies whether
to compile an advised definition in case the COMPILE argument to
`ad-activate-on' or one of its friends was supplied as nil.
(ad-preactivate-advice): Supply negative COMPILE argument to prevent
compilation.
(ad-should-compile): New function.
(ad-activate-advised-definition): Use `ad-should-compile' to determine
whether an advised definition should get compiled.
(ad-activate-on, ad-update, ad-activate-regexp, ad-update-regexp)
(ad-activate-all): Doc fixes.
(ad-update): Leave handling of COMPILE up to `ad-activate-on'.
Extracted construction of freeze-advices from `defadvice':
(ad-make-freeze-definition): New function.
(defadvice): Use `ad-make-freeze-definition' to construct frozen defs.
Removed advice. Byte-compilation problem is now taken care of
directly by the compiler.
(ad-advised-byte-compilers): Removed.
(ad-enable-definition-hooks, ad-disable-definition-hooks): Removed
activation of the advised byte-compiler entry points.
(ad-lemacs-p): Removed variable.
(ad-lemacs-p): New macro for compile-time conditionalization.
Removed autoload for `backquote'.
Removed arglist specifications for `documentation' and `fset'.
(ad-emacs19-p, ad-use-jwz-compiler): Removed these variables.
(ad-lemacs-p, ad-v19-compiled-p, ad-subr-arglist,
ad-make-advised-docstring): Removed reference to `ad-emacs19-p'.
(ad-compiled-p): Renamed from `ad-v19-compiled-p'. Removed old
definition of `ad-compiled-p'.
(ad-compiled-code): Renamed from `ad-v19-compiled-code'.
(ad-arglists, ad-docstring, ad-interactive-form): Use new names.
(ad-body-forms): Always return nil for compiled definitions.
(ad-compile-function): Simplified, because the v19 incarnation of
`byte-compile' can compile macros.
(ad-real-byte-codify): Removed.
(ad-execute-defadvices): Removed. The `defadvice's it contained
are now at the top level.
(ad-advised-byte-code-definition): Renamed to `ad-advised-byte-code'
and removed the definition of `ad-advised-byte-code' via `fset'.
(ad-advised-byte-code-definition, ad-recover-byte-code,
ad-stop-advice, ad-recover-normality): Removed
`ad-real-byte-codify'-cation of their definitions.
(ad-adjust-stack-sizes): Removed.
(ad-enable-definition-hooks, ad-disable-definition-hooks):
Removed v19 conditionalization.
Fixed the problematic interaction between the
byte-compiler and Advice when `ad-activate-on-definition' was t which
resulted in erroneous compilation of nested `defun/defmacro's:
(byte-compile-from-buffer, byte-compile-top-level): Advised
to temporarily deactivate the advice of `defun/defmacro'.
(ad-advised-definers, ad-advised-byte-compilers): New variables.
(ad-enable-definition-hooks, ad-disable-definition-hooks):
En/disable the advised byte-compiler entry points.
(defadvice): Implement a `freeze' option which expands
the `defadvice' into a redefining and dumpable `defun/defmacro'
whose documentation can be written to the `DOC' file. Frozen
advices cannot be undone, hence, they do not need any Advice
runtime support.
(ad-defadvice-flags): Add `freeze' flag.
(ad-make-advised-docstring, ad-make-single-advice-docstring):
New STYLE option for `plain' and `freeze' styles. Slightly
changed the default formatting of advised docstrings.
(ad-make-plain-docstring, ad-make-freeze-docstring): New functions.
(ad-recover-all, ad-scan-byte-code-for-fsets):
Removed unused condition variable `ignore-errors'.
(ad-save-real-definition): New macro to save real
definitions of functions used by Advice.
Use `ad-save-real-definition' to save definitions of `fset',
`byte-code' and now also `documentation'.
(ad-subr-arglist, ad-docstring, ad-make-advised-docstring):
Use `ad-real-documentation' to avoid interference with the
advised version of `documentation'.
(ad-execute-defadvices): Copy advice infos.
(ad-start-advice-on-load): Default changed to t.