aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Abrahamsen2014-11-02 17:24:33 +0200
committerEli Zaretskii2014-11-02 17:24:33 +0200
commitfce9e55323dc900473304cc6a31e374a1c943460 (patch)
tree193281f72323ed6bbabf5a7a97350e7d0acc3b84
parent4a48e97cf905468d6e09c3dd7a5ae7f7489badd5 (diff)
downloademacs-fce9e55323dc900473304cc6a31e374a1c943460.tar.gz
emacs-fce9e55323dc900473304cc6a31e374a1c943460.zip
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'.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/emacs-lisp/eieio.el20
2 files changed, 14 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 63663e878b9..ec6b21a7e95 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12014-11-02 Eric Abrahamsen <eric@ericabrahamsen.net>
2
3 * emacs-lisp/eieio.el (eieio-edebug-prin1-to-string): Adjust for
4 use as advice.
5 (edebug-setup-hook): Advise `edebug-prin1-to-string'. (Bug#18897)
6
12014-11-02 Stefan Monnier <monnier@iro.umontreal.ca> 72014-11-02 Stefan Monnier <monnier@iro.umontreal.ca>
2 8
3 * emacs-lisp/pp.el (pp-macroexpand-expression): Use macroexpand-1 9 * emacs-lisp/pp.el (pp-macroexpand-expression): Use macroexpand-1
diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el
index d7c60dc6dd5..df2ce0f984b 100644
--- a/lisp/emacs-lisp/eieio.el
+++ b/lisp/emacs-lisp/eieio.el
@@ -853,17 +853,19 @@ of `eq'."
853 853
854;;; Interfacing with edebug 854;;; Interfacing with edebug
855;; 855;;
856(defun eieio-edebug-prin1-to-string (object &optional noescape) 856(defun eieio-edebug-prin1-to-string (print-function object &optional noescape)
857 "Display EIEIO OBJECT in fancy format. 857 "Display EIEIO OBJECT in fancy format.
858Overrides the edebug default. 858
859Optional argument NOESCAPE is passed to `prin1-to-string' when appropriate." 859Used as advice around `edebug-prin1-to-string', held in the
860variable PRINT-FUNCTION. Optional argument NOESCAPE is passed to
861`prin1-to-string' when appropriate."
860 (cond ((class-p object) (eieio-class-name object)) 862 (cond ((class-p object) (eieio-class-name object))
861 ((eieio-object-p object) (object-print object)) 863 ((eieio-object-p object) (object-print object))
862 ((and (listp object) (or (class-p (car object)) 864 ((and (listp object) (or (class-p (car object))
863 (eieio-object-p (car object)))) 865 (eieio-object-p (car object))))
864 (concat "(" (mapconcat #'eieio-edebug-prin1-to-string object " ") 866 (concat "(" (mapconcat #'eieio-edebug-prin1-to-string object " ")
865 ")")) 867 ")"))
866 (t (prin1-to-string object noescape)))) 868 (t (funcall print-function object noescape))))
867 869
868(add-hook 'edebug-setup-hook 870(add-hook 'edebug-setup-hook
869 (lambda () 871 (lambda ()
@@ -887,14 +889,8 @@ Optional argument NOESCAPE is passed to `prin1-to-string' when appropriate."
887 (def-edebug-spec class-constructor form) 889 (def-edebug-spec class-constructor form)
888 (def-edebug-spec generic-p form) 890 (def-edebug-spec generic-p form)
889 (def-edebug-spec with-slots (list list def-body)) 891 (def-edebug-spec with-slots (list list def-body))
890 ;; I suspect this isn't the best way to do this, but when 892 (advice-add 'edebug-prin1-to-string
891 ;; cust-print was used on my system all my objects 893 :around #'eieio-edebug-prin1-to-string)))
892 ;; appeared as "#1 =" which was not useful. This allows
893 ;; edebug to print my objects in the nice way they were
894 ;; meant to with `object-print' and `class-name'
895 ;; (defalias 'edebug-prin1-to-string 'eieio-edebug-prin1-to-string)
896 )
897 )
898 894
899 895
900;;; Start of automatically extracted autoloads. 896;;; Start of automatically extracted autoloads.