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

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

[elpa] externals/trie 6a449ed 049/111: Improved edebug-prin1 advice


From: Stefan Monnier
Subject: [elpa] externals/trie 6a449ed 049/111: Improved edebug-prin1 advice
Date: Mon, 14 Dec 2020 11:35:18 -0500 (EST)

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

    Improved edebug-prin1 advice
---
 trie.el | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/trie.el b/trie.el
index 665d5c4..605eb6c 100644
--- a/trie.el
+++ b/trie.el
@@ -1908,24 +1908,35 @@ elements that matched the corresponding groups, in 
order."
   (require 'advice))
 
 
+(defun trie--edebug-pretty-print (object)
+  (cond
+   ((trie-p object) "#<trie>")
+   ((and object (listp object))
+    (concat "(" (mapconcat 'trie--edebug-pretty-print object " ")
+           ")"))
+   (t (prin1-to-string object))))
+
+
 (ad-define-subr-args 'edebug-prin1 '(object &optional printcharfun))
 
 (defadvice edebug-prin1
   (around trie activate compile preactivate)
-  (if (trie-p object)
-      (progn
-       (prin1 "#<trie>" printcharfun)
-       (setq ad-return-value "<#trie>"))
-    ad-do-it))
+  (let ((pretty (trie--edebug-pretty-print object)))
+    (if pretty
+       (progn
+         (prin1 pretty printcharfun)
+         (setq ad-return-value pretty))
+    ad-do-it)))
 
 
 (ad-define-subr-args 'edebug-prin1-to-string '(object &optional noescape))
 
 (defadvice edebug-prin1-to-string
   (around trie activate compile preactivate)
-  (if (trie-p object)
-      (setq ad-return-value "#<trie>")
-    ad-do-it))
+  (let ((pretty (trie--edebug-pretty-print object)))
+    (if pretty
+       (setq ad-return-value pretty)
+      ad-do-it)))
 
 
 



reply via email to

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