[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/trie 91d299c 104/111: Pretty-print trie nodes in edebug
From: |
Stefan Monnier |
Subject: |
[elpa] externals/trie 91d299c 104/111: Pretty-print trie nodes in edebug. |
Date: |
Mon, 14 Dec 2020 11:35:30 -0500 (EST) |
branch: externals/trie
commit 91d299c0865bf36b58668617cccf1aa5058f8b3d
Author: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Pretty-print trie nodes in edebug.
---
trie.el | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/trie.el b/trie.el
index 079dc9b..428911f 100644
--- a/trie.el
+++ b/trie.el
@@ -2966,9 +2966,14 @@ results\)."
(defun trie--prin1 (_trie stream)
(princ "#<trie>" stream))
+(defun trie--node-prin1 (_trie stream)
+ (princ "#<trie>" stream))
+
(defun trie--edebug-pretty-print (object)
(cond
((trie-p object) "#<trie>")
+ ((and (trie--node-p object) (cl-struct-p (trie--node-subtree object)))
+ "#<trie--node>")
((null object) "nil")
((let ((tlist object) (test t))
(while (or (trie-p (car-safe tlist))
@@ -2976,6 +2981,13 @@ results\)."
(setq tlist (cdr tlist)))
test)
(concat "(" (mapconcat (lambda (_dummy) "#<trie>") object " ") ")"))
+ ((let ((tlist object) (test t))
+ (while (or (and (trie--node-p (car-safe tlist))
+ (cl-struct-p (trie--node-subtree (car tlist))))
+ (and tlist (setq test nil)))
+ (setq tlist (cdr tlist)))
+ test)
+ (concat "(" (mapconcat (lambda (_dummy) "#<trie--node>") object " ") ")"))
;; ((vectorp object)
;; (let ((pretty "[") (len (length object)))
;; (dotimes (i (1- len))
@@ -2989,15 +3001,15 @@ results\)."
;; "]")))
))
-(if (fboundp 'cl-print-object)
- (cl-defmethod cl-print-object ((object trie-) stream)
- (trie--prin1 object stream))
+(when (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)
+ (around trie '(object) activate compile preactivate)
(let ((pretty (trie--edebug-pretty-print object)))
(if pretty
(progn
@@ -3009,11 +3021,11 @@ results\)."
(ad-define-subr-args 'edebug-prin1-to-string '(object &optional noescape)))
(defadvice edebug-prin1-to-string
- (around trie activate compile preactivate)
+ (around trie (object) activate compile preactivate)
(let ((pretty (trie--edebug-pretty-print object)))
(if pretty
(setq ad-return-value pretty)
- ad-do-it))))
+ ad-do-it)));)
(provide 'trie)
- [elpa] externals/trie b4d81bf 064/111: Trivial whitespace tidying., (continued)
- [elpa] externals/trie b4d81bf 064/111: Trivial whitespace tidying., Stefan Monnier, 2020/12/14
- [elpa] externals/trie d45e9d5 062/111: Added autoload cookies., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 1c2790d 038/111: Replaced wildcard searches with more powerful and efficient regexp searches., Stefan Monnier, 2020/12/14
- [elpa] externals/trie bbfecae 085/111: Do lexbind test at compile-time instead of load-time., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 5e8e73f 081/111: Fix data wrapping handling in fuzzy query functions., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 2a9d7ec 099/111: Port efficiency improvements to trie-fuzzy-match., Stefan Monnier, 2020/12/14
- [elpa] externals/trie a2554d6 094/111: Fix function symbol quoting., Stefan Monnier, 2020/12/14
- [elpa] externals/trie c6ddbb9 096/111: Bump version numbers., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 94a1a86 087/111: Bump version numbers since we've added iterator generators., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 4001f61 097/111: Fix corresponding bug in trie-fuzzy-complete-stack., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 91d299c 104/111: Pretty-print trie nodes in edebug.,
Stefan Monnier <=
- [elpa] externals/trie fc9b218 032/111: Removed support for non-terminal * wildcards, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 5a064c0 092/111: Fix bug in trie-delete return value., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 9f49d95 086/111: Implement iterator generators on collection data structures., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 2957aec 103/111: Fix bugs in trie-fuzzy-match/complete., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 3a734c3 077/111: Implement trie-fuzzy-match and trie-fuzzy-complete functions., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 9259d51 088/111: Improve edebug pretty-printing., Stefan Monnier, 2020/12/14
- [elpa] externals/trie 81899c0 110/111: * packages/trie/trie.el (trie--if-lexical-binding): Simplify, Stefan Monnier, 2020/12/14
- [elpa] externals/trie 31c4ac2 024/111: Implemented trie-wildcard-stacks!, Stefan Monnier, 2020/12/14
- [elpa] externals/trie a438b01 090/111: Fix bugs in lexical binding support(?), Stefan Monnier, 2020/12/14
- [elpa] externals/trie ee4b459 106/111: Allow pruning of trie branches in queries., Stefan Monnier, 2020/12/14