diff options
Diffstat (limited to 'lisp/emacs-lisp/eieio.el')
-rw-r--r-- | lisp/emacs-lisp/eieio.el | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index 6872c0f4489..1a6d5e9d7c1 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -825,6 +825,7 @@ first and modify the returned object.") It is sometimes useful to put a summary of the object into the default #<notation> string when using EIEIO browsing tools. Implement this method to customize the summary." + (declare (obsolete cl-print-object "26.1")) (format "%S" this)) (cl-defmethod object-print ((this eieio-default-superclass) &rest strings) @@ -841,6 +842,12 @@ When passing in extra strings from child classes, always remember to prepend a space." (eieio-object-name this (apply #'concat strings))) + +(cl-defmethod cl-print-object ((object eieio-default-superclass) stream) + "Default printer for EIEIO objects." + ;; Fallback to the old `object-print'. + (princ (object-print object) stream)) + (defvar eieio-print-depth 0 "When printing, keep track of the current indentation depth.") @@ -945,27 +952,6 @@ of `eq'." ;; hyperlink from the constructor's docstring to see the type definition. (add-hook 'help-fns-describe-function-functions 'eieio-help-constructor) -;;; Interfacing with edebug -;; -(defun eieio-edebug-prin1-to-string (print-function object &optional noescape) - "Display EIEIO OBJECT in fancy format. - -Used as advice around `edebug-prin1-to-string', held in the -variable PRINT-FUNCTION. Optional argument NOESCAPE is passed to -`prin1-to-string' when appropriate." - (cond ((eieio--class-p object) (eieio--class-print-name object)) - ((eieio-object-p object) (object-print object)) - ((and (listp object) (or (eieio--class-p (car object)) - (eieio-object-p (car object)))) - (concat "(" (mapconcat - (lambda (x) (eieio-edebug-prin1-to-string print-function x)) - object " ") - ")")) - (t (funcall print-function object noescape)))) - -(advice-add 'edebug-prin1-to-string - :around #'eieio-edebug-prin1-to-string) - (provide 'eieio) ;;; eieio ends here |