- (setq ad-return-value pretty))
- ad-do-it)))
-
-
-(when (fboundp 'ad-define-subr-args)
- (ad-define-subr-args 'edebug-prin1-to-string '(object &optional noescape)))
-
-(defadvice edebug-prin1-to-string
- (around trie activate compile preactivate)
- (let ((pretty (trie--edebug-pretty-print object)))
- (if pretty
- (setq ad-return-value pretty)
- ad-do-it)))
+ pretty)
+ (funcall orig object printcharfun))))
+
+(defun trie--edebug-prin1-to-string (orig object &optional noescape)
+ (or (trie--edebug-pretty-print object)
+ (funcall orig object noescape)))
+
+(if (fboundp 'advice-add)
+ (progn
+ (advice-add 'edebug-prin1 :around #'trie--edebug-prin1)
+ (advice-add 'edebug-prin1-to-string
+ :around #'trie--edebug-prin1-to-string))
+
+ (when (fboundp 'ad-define-subr-args)
+ (ad-define-subr-args 'edebug-prin1 '(object &optional printcharfun)))
+
+ (defadvice edebug-prin1
+ (around trie activate compile preactivate)
+ (setq ad-return-value
+ (trie--edebug-prin1 (lambda (object printcharfun) ad-do-it)
+ object printcharfun)))
+
+ (when (fboundp 'ad-define-subr-args)
+ (ad-define-subr-args 'edebug-prin1-to-string '(object &optional noescape)))
+
+ (defadvice edebug-prin1-to-string
+ (around trie activate compile preactivate)
+ (setq ad-return-value
+ (trie--edebug-prin1-to-string (lambda (object noescape) ad-do-it)
+ object noescape))))