summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2022-04-26 16:39:41 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2022-04-26 17:36:13 -0400
commitf30625943edefbd88ebf84acbc254ed88db27beb (patch)
tree6bbf46ff01195583b8f5aac5e51584075171747a /test/lisp/emacs-lisp
parentbc9be5449e1127bc1b05a6cad8471c6eba52c8e9 (diff)
downloademacs-f30625943edefbd88ebf84acbc254ed88db27beb.tar.gz
emacs-f30625943edefbd88ebf84acbc254ed88db27beb.tar.bz2
emacs-f30625943edefbd88ebf84acbc254ed88db27beb.zip
nadvice.el: Use OClosures
* lisp/emacs-lisp/nadvice.el (advice): New OClosure type. (advice--how-alist): Make it hold prototype OClosures rather than bytecode strings. (advice--bytecodes): Delete var. (advice--where): Make it an obsolete alias of new `advice--how`. (oclosure-interactive-form, cl-print-object) <advice>: New methods. (advice--make-1): Delete function. (advice--make): Use `advice-copy` and `advice-cons`. (advice--tweak): Use `advice-cons`. (add-function, advice-add): Rename `where` arg to `how`. * lisp/emacs-lisp/cl-print.el (cl-print-object) <:extra "nadvice">: Remove now-redundant ad-hoc method. * test/lisp/emacs-lisp/nadvice-tests.el (advice-test-print): New test.
Diffstat (limited to 'test/lisp/emacs-lisp')
-rw-r--r--test/lisp/emacs-lisp/nadvice-tests.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/nadvice-tests.el b/test/lisp/emacs-lisp/nadvice-tests.el
index 1185bee447b..a675986b90b 100644
--- a/test/lisp/emacs-lisp/nadvice-tests.el
+++ b/test/lisp/emacs-lisp/nadvice-tests.el
@@ -204,6 +204,15 @@ function being an around advice."
(remove-function (var sm-test10) sm-advice)
(should (equal (funcall sm-test10 5) 15))))
+(ert-deftest advice-test-print ()
+ (let ((x (list 'cdr)))
+ (add-function :after (car x) 'car)
+ (should (equal (cl-prin1-to-string (car x))
+ "#f(advice car :after cdr)"))
+ (add-function :before (car x) 'first)
+ (should (equal (cl-prin1-to-string (car x))
+ "#f(advice first :before #f(advice car :after cdr))"))))
+
;; Local Variables:
;; no-byte-compile: t
;; End: