emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/trie 9259d51 088/111: Improve edebug pretty-printing.


From: Stefan Monnier
Subject: [elpa] externals/trie 9259d51 088/111: Improve edebug pretty-printing.
Date: Mon, 14 Dec 2020 11:35:26 -0500 (EST)

branch: externals/trie
commit 9259d51ba3490520fce6a3d35db4b45b56ac8cd5
Author: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>

    Improve edebug pretty-printing.
---
 trie.el | 51 +++++++++++++++++++++++++++------------------------
 1 file changed, 27 insertions(+), 24 deletions(-)

diff --git a/trie.el b/trie.el
index e46cf1a..565df70 100644
--- a/trie.el
+++ b/trie.el
@@ -2739,6 +2739,8 @@ results\)."
   (require 'edebug)
   (require 'advice))
 
+(defun trie--prin1 (_trie stream)
+  (princ "#<trie>" stream))
 
 (defun trie--edebug-pretty-print (object)
   (cond
@@ -2763,30 +2765,31 @@ results\)."
 ;;           "]")))
    ))
 
-
-(when (fboundp 'ad-define-subr-args)
-  (ad-define-subr-args 'edebug-prin1 '(object &optional printcharfun)))
-
-(defadvice edebug-prin1
-  (around trie activate compile preactivate)
-  (let ((pretty (trie--edebug-pretty-print object)))
-    (if pretty
-       (progn
-         (prin1 pretty printcharfun)
-         (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)))
-
+(if (fboundp 'cl-print-object)
+    (cl-defmethod cl-print-object ((object trie-) stream)
+      (trie--prin1 object stream))
+
+  (when (fboundp 'ad-define-subr-args)
+    (ad-define-subr-args 'edebug-prin1 '(object &optional printcharfun)))
+
+  (defadvice edebug-prin1
+      (around trie activate compile preactivate)
+    (let ((pretty (trie--edebug-pretty-print object)))
+      (if pretty
+         (progn
+           (prin1 pretty printcharfun)
+           (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))))
 
 
 (provide 'trie)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]