diff options
| author | Richard M. Stallman | 1999-11-26 17:46:05 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1999-11-26 17:46:05 +0000 |
| commit | 850da9d0928101280a88d88bb40a5bd54378bd56 (patch) | |
| tree | 5846018a81f5c11cac93ba6440ef5714a451e828 | |
| parent | 66c8215f1fc6931400a802fc94e9d588373e1ce5 (diff) | |
| download | emacs-850da9d0928101280a88d88bb40a5bd54378bd56.tar.gz emacs-850da9d0928101280a88d88bb40a5bd54378bd56.zip | |
Many doc fixes.
| -rw-r--r-- | lisp/emacs-lisp/advice.el | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index cf6dbe3c7f3..0a4756559e8 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el | |||
| @@ -3,8 +3,8 @@ | |||
| 3 | ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1993, 1994 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Hans Chalupsky <hans@cs.buffalo.edu> | 5 | ;; Author: Hans Chalupsky <hans@cs.buffalo.edu> |
| 6 | ;; Maintainer: FSF | ||
| 6 | ;; Created: 12 Dec 1992 | 7 | ;; Created: 12 Dec 1992 |
| 7 | ;; Version: advice.el,v 2.14 1994/08/05 03:42:04 hans Exp | ||
| 8 | ;; Keywords: extensions, lisp, tools | 8 | ;; Keywords: extensions, lisp, tools |
| 9 | 9 | ||
| 10 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| @@ -3538,7 +3538,7 @@ The current definition and its cache-id will be put into the cache." | |||
| 3538 | function (symbol-function function) (ad-make-cache-id function))))) | 3538 | function (symbol-function function) (ad-make-cache-id function))))) |
| 3539 | 3539 | ||
| 3540 | (defun ad-handle-definition (function) | 3540 | (defun ad-handle-definition (function) |
| 3541 | "Handles re/definition of an advised FUNCTION during de/activation. | 3541 | "Handle re/definition of an advised FUNCTION during de/activation. |
| 3542 | If FUNCTION does not have an original definition associated with it and | 3542 | If FUNCTION does not have an original definition associated with it and |
| 3543 | the current definition is usable, then it will be stored as FUNCTION's | 3543 | the current definition is usable, then it will be stored as FUNCTION's |
| 3544 | original definition. If no current definition is available (even in the | 3544 | original definition. If no current definition is available (even in the |
| @@ -3582,7 +3582,7 @@ the value of `ad-redefinition-action' and de/activate again." | |||
| 3582 | ;; ================================== | 3582 | ;; ================================== |
| 3583 | 3583 | ||
| 3584 | (defun ad-activate (function &optional compile) | 3584 | (defun ad-activate (function &optional compile) |
| 3585 | "Activates all the advice information of an advised FUNCTION. | 3585 | "Activate all the advice information of an advised FUNCTION. |
| 3586 | If FUNCTION has a proper original definition then an advised | 3586 | If FUNCTION has a proper original definition then an advised |
| 3587 | definition will be generated from FUNCTION's advice info and the | 3587 | definition will be generated from FUNCTION's advice info and the |
| 3588 | definition of FUNCTION will be replaced with it. If a previously | 3588 | definition of FUNCTION will be replaced with it. If a previously |
| @@ -3622,7 +3622,7 @@ definition will always be cached for later usage." | |||
| 3622 | (defalias 'ad-activate-on 'ad-activate) | 3622 | (defalias 'ad-activate-on 'ad-activate) |
| 3623 | 3623 | ||
| 3624 | (defun ad-deactivate (function) | 3624 | (defun ad-deactivate (function) |
| 3625 | "Deactivates the advice of an actively advised FUNCTION. | 3625 | "Deactivate the advice of an actively advised FUNCTION. |
| 3626 | If FUNCTION has a proper original definition, then the current | 3626 | If FUNCTION has a proper original definition, then the current |
| 3627 | definition of FUNCTION will be replaced with it. All the advice | 3627 | definition of FUNCTION will be replaced with it. All the advice |
| 3628 | information will still be available so it can be activated again with | 3628 | information will still be available so it can be activated again with |
| @@ -3651,7 +3651,7 @@ See `ad-activate' for documentation on the optional COMPILE argument." | |||
| 3651 | (ad-activate function compile))) | 3651 | (ad-activate function compile))) |
| 3652 | 3652 | ||
| 3653 | (defun ad-unadvise (function) | 3653 | (defun ad-unadvise (function) |
| 3654 | "Deactivates FUNCTION and then remove all its advice information. | 3654 | "Deactivate FUNCTION and then remove all its advice information. |
| 3655 | If FUNCTION was not advised this will be a noop." | 3655 | If FUNCTION was not advised this will be a noop." |
| 3656 | (interactive | 3656 | (interactive |
| 3657 | (list (ad-read-advised-function "Unadvise function: "))) | 3657 | (list (ad-read-advised-function "Unadvise function: "))) |
| @@ -3663,9 +3663,9 @@ If FUNCTION was not advised this will be a noop." | |||
| 3663 | (ad-pop-advised-function function)))) | 3663 | (ad-pop-advised-function function)))) |
| 3664 | 3664 | ||
| 3665 | (defun ad-recover (function) | 3665 | (defun ad-recover (function) |
| 3666 | "Try to recover FUNCTION's original definition and unadvises it. | 3666 | "Try to recover FUNCTION's original definition, and unadvise it. |
| 3667 | This is more low-level than `ad-unadvise' because it does not do any | 3667 | This is more low-level than `ad-unadvise' in that it does not do |
| 3668 | deactivation which might run hooks and get into other trouble. | 3668 | deactivation, which might run hooks and get into other trouble." |
| 3669 | Use in emergencies." | 3669 | Use in emergencies." |
| 3670 | ;; Use more primitive interactive behavior here: Accept any symbol that's | 3670 | ;; Use more primitive interactive behavior here: Accept any symbol that's |
| 3671 | ;; currently defined in obarray, not necessarily with a function definition: | 3671 | ;; currently defined in obarray, not necessarily with a function definition: |
| @@ -3680,7 +3680,9 @@ Use in emergencies." | |||
| 3680 | (ad-pop-advised-function function)))) | 3680 | (ad-pop-advised-function function)))) |
| 3681 | 3681 | ||
| 3682 | (defun ad-activate-regexp (regexp &optional compile) | 3682 | (defun ad-activate-regexp (regexp &optional compile) |
| 3683 | "Activates functions with an advice name containing a REGEXP match. | 3683 | "Activate functions with an advice name containing a REGEXP match. |
| 3684 | This activates the advice for each function | ||
| 3685 | that has at least one piece of advice whose name includes a match for REGEXP. | ||
| 3684 | See `ad-activate' for documentation on the optional COMPILE argument." | 3686 | See `ad-activate' for documentation on the optional COMPILE argument." |
| 3685 | (interactive | 3687 | (interactive |
| 3686 | (list (ad-read-regexp "Activate via advice regexp: ") | 3688 | (list (ad-read-regexp "Activate via advice regexp: ") |
| @@ -3690,7 +3692,9 @@ See `ad-activate' for documentation on the optional COMPILE argument." | |||
| 3690 | (ad-activate function compile)))) | 3692 | (ad-activate function compile)))) |
| 3691 | 3693 | ||
| 3692 | (defun ad-deactivate-regexp (regexp) | 3694 | (defun ad-deactivate-regexp (regexp) |
| 3693 | "Deactivates functions with an advice name containing REGEXP match." | 3695 | "Deactivate functions with an advice name containing REGEXP match. |
| 3696 | This deactivates the advice for each function | ||
| 3697 | that has at least one piece of advice whose name includes a match for REGEXP." | ||
| 3694 | (interactive | 3698 | (interactive |
| 3695 | (list (ad-read-regexp "Deactivate via advice regexp: "))) | 3699 | (list (ad-read-regexp "Deactivate via advice regexp: "))) |
| 3696 | (ad-do-advised-functions (function) | 3700 | (ad-do-advised-functions (function) |
| @@ -3699,6 +3703,8 @@ See `ad-activate' for documentation on the optional COMPILE argument." | |||
| 3699 | 3703 | ||
| 3700 | (defun ad-update-regexp (regexp &optional compile) | 3704 | (defun ad-update-regexp (regexp &optional compile) |
| 3701 | "Update functions with an advice name containing a REGEXP match. | 3705 | "Update functions with an advice name containing a REGEXP match. |
| 3706 | This reactivates the advice for each function | ||
| 3707 | that has at least one piece of advice whose name includes a match for REGEXP. | ||
| 3702 | See `ad-activate' for documentation on the optional COMPILE argument." | 3708 | See `ad-activate' for documentation on the optional COMPILE argument." |
| 3703 | (interactive | 3709 | (interactive |
| 3704 | (list (ad-read-regexp "Update via advice regexp: ") | 3710 | (list (ad-read-regexp "Update via advice regexp: ") |
| @@ -3708,14 +3714,14 @@ See `ad-activate' for documentation on the optional COMPILE argument." | |||
| 3708 | (ad-update function compile)))) | 3714 | (ad-update function compile)))) |
| 3709 | 3715 | ||
| 3710 | (defun ad-activate-all (&optional compile) | 3716 | (defun ad-activate-all (&optional compile) |
| 3711 | "Activates all currently advised functions. | 3717 | "Activate all currently advised functions. |
| 3712 | See `ad-activate' for documentation on the optional COMPILE argument." | 3718 | See `ad-activate' for documentation on the optional COMPILE argument." |
| 3713 | (interactive "P") | 3719 | (interactive "P") |
| 3714 | (ad-do-advised-functions (function) | 3720 | (ad-do-advised-functions (function) |
| 3715 | (ad-activate function compile))) | 3721 | (ad-activate function compile))) |
| 3716 | 3722 | ||
| 3717 | (defun ad-deactivate-all () | 3723 | (defun ad-deactivate-all () |
| 3718 | "Deactivates all currently advised functions." | 3724 | "Deactivate all currently advised functions." |
| 3719 | (interactive) | 3725 | (interactive) |
| 3720 | (ad-do-advised-functions (function) | 3726 | (ad-do-advised-functions (function) |
| 3721 | (ad-deactivate function))) | 3727 | (ad-deactivate function))) |
| @@ -3728,13 +3734,17 @@ With prefix argument, COMPILE resulting advised definitions." | |||
| 3728 | (ad-update function compile))) | 3734 | (ad-update function compile))) |
| 3729 | 3735 | ||
| 3730 | (defun ad-unadvise-all () | 3736 | (defun ad-unadvise-all () |
| 3731 | "Unadvises all currently advised functions." | 3737 | "Unadvise all currently advised functions." |
| 3732 | (interactive) | 3738 | (interactive) |
| 3733 | (ad-do-advised-functions (function) | 3739 | (ad-do-advised-functions (function) |
| 3734 | (ad-unadvise function))) | 3740 | (ad-unadvise function))) |
| 3735 | 3741 | ||
| 3736 | (defun ad-recover-all () | 3742 | (defun ad-recover-all () |
| 3737 | "Recovers all currently advised functions. Use in emergencies." | 3743 | "Recover all currently advised functions. Use in emergencies. |
| 3744 | To recover a function means to try to find its original (pre-advice) | ||
| 3745 | definition, and delete all advice. | ||
| 3746 | This is more low-level than `ad-unadvise' in that it does not do | ||
| 3747 | deactivation, which might run hooks and get into other trouble." | ||
| 3738 | (interactive) | 3748 | (interactive) |
| 3739 | (ad-do-advised-functions (function) | 3749 | (ad-do-advised-functions (function) |
| 3740 | (condition-case nil | 3750 | (condition-case nil |
| @@ -3945,7 +3955,7 @@ undone on exit of this macro." | |||
| 3945 | (ad-activate 'documentation 'compile)) | 3955 | (ad-activate 'documentation 'compile)) |
| 3946 | 3956 | ||
| 3947 | (defun ad-stop-advice () | 3957 | (defun ad-stop-advice () |
| 3948 | "Stops the automatic advice handling magic. | 3958 | "Stop the automatic advice handling magic. |
| 3949 | You should only need this in case of Advice-related emergencies." | 3959 | You should only need this in case of Advice-related emergencies." |
| 3950 | (interactive) | 3960 | (interactive) |
| 3951 | ;; Advising `ad-activate-internal' means death!! | 3961 | ;; Advising `ad-activate-internal' means death!! |