diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2017-02-23 22:39:53 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2017-02-23 22:39:53 -0500 |
commit | 91932fff1ded8ed3b4d39dd06891f26960153b9e (patch) | |
tree | a01f9fe6556389dab387b4fb8ddcfcfa1c632fe8 /lisp/emacs-lisp/eieio.el | |
parent | f1f17265c9b029929a2f52d206cff0e943690847 (diff) | |
download | emacs-91932fff1ded8ed3b4d39dd06891f26960153b9e.tar.gz |
Use cl-print for Edebug and EIEIO
* lisp/emacs-lisp/edebug.el (edebug-prin1-to-string): Use cl-print.
(edebug-prin1, edebug-print): Remove.
* lisp/emacs-lisp/eieio.el (object-print): Declare obsolete.
(cl-print-object): Add a method for EIEIO objects.
(eieio-edebug-prin1-to-string): Delete.
(edebug-prin1-to-string): Don't advise any more.
* lisp/emacs-lisp/eieio-datadebug.el (data-debug-insert-object-button):
Replace `object-print' -> `cl-prin1-to-string'.
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 |