1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00

Fix bug #18897 with printing large objects from eieio.el.

lisp/emacs-lisp/eieio.el (eieio-edebug-prin1-to-string): Adjust
 for use as advice.
 (edebug-setup-hook): Advise `edebug-prin1-to-string'.
This commit is contained in:
Eric Abrahamsen 2014-11-02 17:24:33 +02:00 committed by Eli Zaretskii
parent 4a48e97cf9
commit fce9e55323
2 changed files with 14 additions and 12 deletions

View file

@ -1,3 +1,9 @@
2014-11-02 Eric Abrahamsen <eric@ericabrahamsen.net>
* emacs-lisp/eieio.el (eieio-edebug-prin1-to-string): Adjust for
use as advice.
(edebug-setup-hook): Advise `edebug-prin1-to-string'. (Bug#18897)
2014-11-02 Stefan Monnier <monnier@iro.umontreal.ca> 2014-11-02 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/pp.el (pp-macroexpand-expression): Use macroexpand-1 * emacs-lisp/pp.el (pp-macroexpand-expression): Use macroexpand-1

View file

@ -853,17 +853,19 @@ of `eq'."
;;; Interfacing with edebug ;;; Interfacing with edebug
;; ;;
(defun eieio-edebug-prin1-to-string (object &optional noescape) (defun eieio-edebug-prin1-to-string (print-function object &optional noescape)
"Display EIEIO OBJECT in fancy format. "Display EIEIO OBJECT in fancy format.
Overrides the edebug default.
Optional argument NOESCAPE is passed to `prin1-to-string' when appropriate." 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 ((class-p object) (eieio-class-name object)) (cond ((class-p object) (eieio-class-name object))
((eieio-object-p object) (object-print object)) ((eieio-object-p object) (object-print object))
((and (listp object) (or (class-p (car object)) ((and (listp object) (or (class-p (car object))
(eieio-object-p (car object)))) (eieio-object-p (car object))))
(concat "(" (mapconcat #'eieio-edebug-prin1-to-string object " ") (concat "(" (mapconcat #'eieio-edebug-prin1-to-string object " ")
")")) ")"))
(t (prin1-to-string object noescape)))) (t (funcall print-function object noescape))))
(add-hook 'edebug-setup-hook (add-hook 'edebug-setup-hook
(lambda () (lambda ()
@ -887,14 +889,8 @@ Optional argument NOESCAPE is passed to `prin1-to-string' when appropriate."
(def-edebug-spec class-constructor form) (def-edebug-spec class-constructor form)
(def-edebug-spec generic-p form) (def-edebug-spec generic-p form)
(def-edebug-spec with-slots (list list def-body)) (def-edebug-spec with-slots (list list def-body))
;; I suspect this isn't the best way to do this, but when (advice-add 'edebug-prin1-to-string
;; cust-print was used on my system all my objects :around #'eieio-edebug-prin1-to-string)))
;; appeared as "#1 =" which was not useful. This allows
;; edebug to print my objects in the nice way they were
;; meant to with `object-print' and `class-name'
;; (defalias 'edebug-prin1-to-string 'eieio-edebug-prin1-to-string)
)
)
;;; Start of automatically extracted autoloads. ;;; Start of automatically extracted autoloads.