diff options
| author | Gerd Moellmann | 1999-10-26 23:27:31 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-10-26 23:27:31 +0000 |
| commit | 5f6bb68adf5d7b51453881f1ed01c820687230b4 (patch) | |
| tree | e59225a554e440da9af70a0cec9737c725062611 /lisp | |
| parent | c1307a23604a74e932a17588c1270ceee894be80 (diff) | |
| download | emacs-5f6bb68adf5d7b51453881f1ed01c820687230b4.tar.gz emacs-5f6bb68adf5d7b51453881f1ed01c820687230b4.zip | |
(ad-activate-internal): Renamed from
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.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/emacs-lisp/advice.el | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index 6dab539a019..df0a68d1543 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el | |||
| @@ -2137,31 +2137,31 @@ either t or nil, and DEFINITION should be a list of the form | |||
| 2137 | ;; fset(sym,newdef) | 2137 | ;; fset(sym,newdef) |
| 2138 | ;; assign NEWDEF to SYM | 2138 | ;; assign NEWDEF to SYM |
| 2139 | ;; if (get SYM 'ad-advice-info) | 2139 | ;; if (get SYM 'ad-advice-info) |
| 2140 | ;; ad-activate(SYM, nil) | 2140 | ;; ad-activate-internal(SYM, nil) |
| 2141 | ;; return (symbol-function SYM) | 2141 | ;; return (symbol-function SYM) |
| 2142 | ;; | 2142 | ;; |
| 2143 | ;; Whether advised definitions created by automatic activations will be | 2143 | ;; Whether advised definitions created by automatic activations will be |
| 2144 | ;; compiled depends on the value of `ad-default-compilation-action'. | 2144 | ;; compiled depends on the value of `ad-default-compilation-action'. |
| 2145 | 2145 | ||
| 2146 | ;; Since calling `ad-activate' in the built-in definition of `fset' can | 2146 | ;; Since calling `ad-activate-internal' in the built-in definition of `fset' can |
| 2147 | ;; create major disasters we have to be a bit careful. One precaution is | 2147 | ;; create major disasters we have to be a bit careful. One precaution is |
| 2148 | ;; to provide a dummy definition for `ad-activate' which can be used to | 2148 | ;; to provide a dummy definition for `ad-activate-internal' which can be used to |
| 2149 | ;; turn off automatic advice activation (e.g., when `ad-stop-advice' or | 2149 | ;; turn off automatic advice activation (e.g., when `ad-stop-advice' or |
| 2150 | ;; `ad-recover-normality' are called). Another is to avoid recursive calls | 2150 | ;; `ad-recover-normality' are called). Another is to avoid recursive calls |
| 2151 | ;; to `ad-activate-on' by using `ad-with-auto-activation-disabled' where | 2151 | ;; to `ad-activate' by using `ad-with-auto-activation-disabled' where |
| 2152 | ;; appropriate, especially in a safe version of `fset'. | 2152 | ;; appropriate, especially in a safe version of `fset'. |
| 2153 | 2153 | ||
| 2154 | ;; For now define `ad-activate' to the dummy definition: | 2154 | ;; For now define `ad-activate-internal' to the dummy definition: |
| 2155 | (defun ad-activate (function &optional compile) | 2155 | (defun ad-activate-internal (function &optional compile) |
| 2156 | "Automatic advice activation is disabled. `ad-start-advice' enables it." | 2156 | "Automatic advice activation is disabled. `ad-start-advice' enables it." |
| 2157 | nil) | 2157 | nil) |
| 2158 | 2158 | ||
| 2159 | ;; This is just a copy of the above: | 2159 | ;; This is just a copy of the above: |
| 2160 | (defun ad-activate-off (function &optional compile) | 2160 | (defun ad-activate-internal-off (function &optional compile) |
| 2161 | "Automatic advice activation is disabled. `ad-start-advice' enables it." | 2161 | "Automatic advice activation is disabled. `ad-start-advice' enables it." |
| 2162 | nil) | 2162 | nil) |
| 2163 | 2163 | ||
| 2164 | ;; This will be t for top-level calls to `ad-activate-on': | 2164 | ;; This will be t for top-level calls to `ad-activate-internal-on': |
| 2165 | (defvar ad-activate-on-top-level t) | 2165 | (defvar ad-activate-on-top-level t) |
| 2166 | 2166 | ||
| 2167 | (defmacro ad-with-auto-activation-disabled (&rest body) | 2167 | (defmacro ad-with-auto-activation-disabled (&rest body) |
| @@ -2169,7 +2169,7 @@ either t or nil, and DEFINITION should be a list of the form | |||
| 2169 | (,@ body)))) | 2169 | (,@ body)))) |
| 2170 | 2170 | ||
| 2171 | (defun ad-safe-fset (symbol definition) | 2171 | (defun ad-safe-fset (symbol definition) |
| 2172 | ;; A safe `fset' which will never call `ad-activate' recursively. | 2172 | ;; A safe `fset' which will never call `ad-activate-internal' recursively. |
| 2173 | (ad-with-auto-activation-disabled | 2173 | (ad-with-auto-activation-disabled |
| 2174 | (ad-real-fset symbol definition))) | 2174 | (ad-real-fset symbol definition))) |
| 2175 | 2175 | ||
| @@ -3399,7 +3399,7 @@ advised definition from scratch." | |||
| 3399 | (ad-add-advice function advice class position) | 3399 | (ad-add-advice function advice class position) |
| 3400 | (ad-enable-advice function class (ad-advice-name advice)) | 3400 | (ad-enable-advice function class (ad-advice-name advice)) |
| 3401 | (ad-clear-cache function) | 3401 | (ad-clear-cache function) |
| 3402 | (ad-activate-on function -1) | 3402 | (ad-activate function -1) |
| 3403 | (if (and (ad-is-active function) | 3403 | (if (and (ad-is-active function) |
| 3404 | (ad-get-cache-definition function)) | 3404 | (ad-get-cache-definition function)) |
| 3405 | (list (ad-get-cache-definition function) | 3405 | (list (ad-get-cache-definition function) |
| @@ -3586,7 +3586,7 @@ the value of `ad-redefinition-action' and de/activate again." | |||
| 3586 | ;; @@ The top-level advice interface: | 3586 | ;; @@ The top-level advice interface: |
| 3587 | ;; ================================== | 3587 | ;; ================================== |
| 3588 | 3588 | ||
| 3589 | (defun ad-activate-on (function &optional compile) | 3589 | (defun ad-activate (function &optional compile) |
| 3590 | "Activates all the advice information of an advised FUNCTION. | 3590 | "Activates all the advice information of an advised FUNCTION. |
| 3591 | If FUNCTION has a proper original definition then an advised | 3591 | If FUNCTION has a proper original definition then an advised |
| 3592 | definition will be generated from FUNCTION's advice info and the | 3592 | definition will be generated from FUNCTION's advice info and the |
| @@ -3606,7 +3606,7 @@ definition will always be cached for later usage." | |||
| 3606 | (list (ad-read-advised-function "Activate advice of: ") | 3606 | (list (ad-read-advised-function "Activate advice of: ") |
| 3607 | current-prefix-arg)) | 3607 | current-prefix-arg)) |
| 3608 | (if ad-activate-on-top-level | 3608 | (if ad-activate-on-top-level |
| 3609 | ;; avoid recursive calls to `ad-activate-on': | 3609 | ;; avoid recursive calls to `ad-activate': |
| 3610 | (ad-with-auto-activation-disabled | 3610 | (ad-with-auto-activation-disabled |
| 3611 | (if (not (ad-is-advised function)) | 3611 | (if (not (ad-is-advised function)) |
| 3612 | (error "ad-activate: `%s' is not advised" function) | 3612 | (error "ad-activate: `%s' is not advised" function) |
| @@ -3646,12 +3646,12 @@ a call to `ad-activate'." | |||
| 3646 | 3646 | ||
| 3647 | (defun ad-update (function &optional compile) | 3647 | (defun ad-update (function &optional compile) |
| 3648 | "Update the advised definition of FUNCTION if its advice is active. | 3648 | "Update the advised definition of FUNCTION if its advice is active. |
| 3649 | See `ad-activate-on' for documentation on the optional COMPILE argument." | 3649 | See `ad-activate' for documentation on the optional COMPILE argument." |
| 3650 | (interactive | 3650 | (interactive |
| 3651 | (list (ad-read-advised-function | 3651 | (list (ad-read-advised-function |
| 3652 | "Update advised definition of: " 'ad-is-active))) | 3652 | "Update advised definition of: " 'ad-is-active))) |
| 3653 | (if (ad-is-active function) | 3653 | (if (ad-is-active function) |
| 3654 | (ad-activate-on function compile))) | 3654 | (ad-activate function compile))) |
| 3655 | 3655 | ||
| 3656 | (defun ad-unadvise (function) | 3656 | (defun ad-unadvise (function) |
| 3657 | "Deactivates FUNCTION and then removes all its advice information. | 3657 | "Deactivates FUNCTION and then removes all its advice information. |
| @@ -3684,13 +3684,13 @@ Use in emergencies." | |||
| 3684 | 3684 | ||
| 3685 | (defun ad-activate-regexp (regexp &optional compile) | 3685 | (defun ad-activate-regexp (regexp &optional compile) |
| 3686 | "Activates functions with an advice name containing a REGEXP match. | 3686 | "Activates functions with an advice name containing a REGEXP match. |
| 3687 | See `ad-activate-on' for documentation on the optional COMPILE argument." | 3687 | See `ad-activate' for documentation on the optional COMPILE argument." |
| 3688 | (interactive | 3688 | (interactive |
| 3689 | (list (ad-read-regexp "Activate via advice regexp: ") | 3689 | (list (ad-read-regexp "Activate via advice regexp: ") |
| 3690 | current-prefix-arg)) | 3690 | current-prefix-arg)) |
| 3691 | (ad-do-advised-functions (function) | 3691 | (ad-do-advised-functions (function) |
| 3692 | (if (ad-find-some-advice function 'any regexp) | 3692 | (if (ad-find-some-advice function 'any regexp) |
| 3693 | (ad-activate-on function compile)))) | 3693 | (ad-activate function compile)))) |
| 3694 | 3694 | ||
| 3695 | (defun ad-deactivate-regexp (regexp) | 3695 | (defun ad-deactivate-regexp (regexp) |
| 3696 | "Deactivates functions with an advice name containing REGEXP match." | 3696 | "Deactivates functions with an advice name containing REGEXP match." |
| @@ -3702,7 +3702,7 @@ See `ad-activate-on' for documentation on the optional COMPILE argument." | |||
| 3702 | 3702 | ||
| 3703 | (defun ad-update-regexp (regexp &optional compile) | 3703 | (defun ad-update-regexp (regexp &optional compile) |
| 3704 | "Updates functions with an advice name containing a REGEXP match. | 3704 | "Updates functions with an advice name containing a REGEXP match. |
| 3705 | See `ad-activate-on' for documentation on the optional COMPILE argument." | 3705 | See `ad-activate' for documentation on the optional COMPILE argument." |
| 3706 | (interactive | 3706 | (interactive |
| 3707 | (list (ad-read-regexp "Update via advice regexp: ") | 3707 | (list (ad-read-regexp "Update via advice regexp: ") |
| 3708 | current-prefix-arg)) | 3708 | current-prefix-arg)) |
| @@ -3712,10 +3712,10 @@ See `ad-activate-on' for documentation on the optional COMPILE argument." | |||
| 3712 | 3712 | ||
| 3713 | (defun ad-activate-all (&optional compile) | 3713 | (defun ad-activate-all (&optional compile) |
| 3714 | "Activates all currently advised functions. | 3714 | "Activates all currently advised functions. |
| 3715 | See `ad-activate-on' for documentation on the optional COMPILE argument." | 3715 | See `ad-activate' for documentation on the optional COMPILE argument." |
| 3716 | (interactive "P") | 3716 | (interactive "P") |
| 3717 | (ad-do-advised-functions (function) | 3717 | (ad-do-advised-functions (function) |
| 3718 | (ad-activate-on function compile))) | 3718 | (ad-activate function compile))) |
| 3719 | 3719 | ||
| 3720 | (defun ad-deactivate-all () | 3720 | (defun ad-deactivate-all () |
| 3721 | "Deactivates all currently advised functions." | 3721 | "Deactivates all currently advised functions." |
| @@ -3856,8 +3856,8 @@ Look at the file `advice.el' for comprehensive documentation." | |||
| 3856 | (, (car preactivation))))))) | 3856 | (, (car preactivation))))))) |
| 3857 | '(, (car (cdr preactivation)))))))) | 3857 | '(, (car (cdr preactivation)))))))) |
| 3858 | (,@ (if (memq 'activate flags) | 3858 | (,@ (if (memq 'activate flags) |
| 3859 | (` ((ad-activate-on '(, function) | 3859 | (` ((ad-activate '(, function) |
| 3860 | (, (if (memq 'compile flags) t))))))) | 3860 | (, (if (memq 'compile flags) t))))))) |
| 3861 | '(, function)))))) | 3861 | '(, function)))))) |
| 3862 | 3862 | ||
| 3863 | 3863 | ||
| @@ -3941,29 +3941,29 @@ undone on exit of this macro." | |||
| 3941 | (defun ad-start-advice () | 3941 | (defun ad-start-advice () |
| 3942 | "Starts the automatic advice handling magic." | 3942 | "Starts the automatic advice handling magic." |
| 3943 | (interactive) | 3943 | (interactive) |
| 3944 | ;; Advising `ad-activate' means death!! | 3944 | ;; Advising `ad-activate-internal' means death!! |
| 3945 | (ad-set-advice-info 'ad-activate nil) | 3945 | (ad-set-advice-info 'ad-activate-internal nil) |
| 3946 | (ad-safe-fset 'ad-activate 'ad-activate-on) | 3946 | (ad-safe-fset 'ad-activate-internal 'ad-activate) |
| 3947 | (ad-enable-advice 'documentation 'after 'ad-advised-docstring) | 3947 | (ad-enable-advice 'documentation 'after 'ad-advised-docstring) |
| 3948 | (ad-activate-on 'documentation 'compile)) | 3948 | (ad-activate 'documentation 'compile)) |
| 3949 | 3949 | ||
| 3950 | (defun ad-stop-advice () | 3950 | (defun ad-stop-advice () |
| 3951 | "Stops the automatic advice handling magic. | 3951 | "Stops the automatic advice handling magic. |
| 3952 | You should only need this in case of Advice-related emergencies." | 3952 | You should only need this in case of Advice-related emergencies." |
| 3953 | (interactive) | 3953 | (interactive) |
| 3954 | ;; Advising `ad-activate' means death!! | 3954 | ;; Advising `ad-activate-internal' means death!! |
| 3955 | (ad-set-advice-info 'ad-activate nil) | 3955 | (ad-set-advice-info 'ad-activate-internal nil) |
| 3956 | (ad-disable-advice 'documentation 'after 'ad-advised-docstring) | 3956 | (ad-disable-advice 'documentation 'after 'ad-advised-docstring) |
| 3957 | (ad-update 'documentation) | 3957 | (ad-update 'documentation) |
| 3958 | (ad-safe-fset 'ad-activate 'ad-activate-off)) | 3958 | (ad-safe-fset 'ad-activate-internal 'ad-activate-internal-off)) |
| 3959 | 3959 | ||
| 3960 | (defun ad-recover-normality () | 3960 | (defun ad-recover-normality () |
| 3961 | "Undoes all advice related redefinitions and unadvises everything. | 3961 | "Undoes all advice related redefinitions and unadvises everything. |
| 3962 | Use only in REAL emergencies." | 3962 | Use only in REAL emergencies." |
| 3963 | (interactive) | 3963 | (interactive) |
| 3964 | ;; Advising `ad-activate' means death!! | 3964 | ;; Advising `ad-activate-internal' means death!! |
| 3965 | (ad-set-advice-info 'ad-activate nil) | 3965 | (ad-set-advice-info 'ad-activate-internal nil) |
| 3966 | (ad-safe-fset 'ad-activate 'ad-activate-off) | 3966 | (ad-safe-fset 'ad-activate-internal 'ad-activate-internal-off) |
| 3967 | (ad-recover-all) | 3967 | (ad-recover-all) |
| 3968 | (setq ad-advised-functions nil)) | 3968 | (setq ad-advised-functions nil)) |
| 3969 | 3969 | ||