summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/oclosure.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2022-04-26 17:30:29 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2022-04-26 17:36:12 -0400
commit21112e3683dd7c1f88028bac4b1835204b8e30f8 (patch)
tree6e06eaf9cd3f3678df6f25753631aa7cb99dbc6c /lisp/emacs-lisp/oclosure.el
parentd35b6a49b33b534f7653bec4d03ab2513a15dc4f (diff)
downloademacs-21112e3683dd7c1f88028bac4b1835204b8e30f8.tar.gz
emacs-21112e3683dd7c1f88028bac4b1835204b8e30f8.tar.bz2
emacs-21112e3683dd7c1f88028bac4b1835204b8e30f8.zip
Pretty print OClosure slot accessors
* lisp/emacs-lisp/oclosure.el (oclosure--accessor-cl-print): New function. * lisp/emacs-lisp/cl-print.el (cl-print-object) <accessor>: New method. * test/lisp/emacs-lisp/nadvice-tests.el (advice-test-call-interactively): Avoid `defun` within a function.
Diffstat (limited to 'lisp/emacs-lisp/oclosure.el')
-rw-r--r--lisp/emacs-lisp/oclosure.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/oclosure.el b/lisp/emacs-lisp/oclosure.el
index 90811199f25..cb8c59b05a2 100644
--- a/lisp/emacs-lisp/oclosure.el
+++ b/lisp/emacs-lisp/oclosure.el
@@ -505,6 +505,13 @@ This has 2 uses:
"OClosure function to access a specific slot of an object."
type slot)
+(defun oclosure--accessor-cl-print (object stream)
+ (princ "#f(accessor " stream)
+ (prin1 (accessor--type object) stream)
+ (princ "." stream)
+ (prin1 (accessor--slot object) stream)
+ (princ ")" stream))
+
(defun oclosure--accessor-docstring (f)
;; This would like to be a (cl-defmethod function-documentation ...)
;; but for circularity reason the defmethod is in `simple.el'.