[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dict-tree 3794988 079/154: Simplified advice-based edeb
From: |
Stefan Monnier |
Subject: |
[elpa] externals/dict-tree 3794988 079/154: Simplified advice-based edebug pretty-printing of tries and dictionaries. |
Date: |
Mon, 14 Dec 2020 12:21:49 -0500 (EST) |
branch: externals/dict-tree
commit 37949889e3539a7ccfe0592b3307725e13d6a9ce
Author: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Simplified advice-based edebug pretty-printing of tries and dictionaries.
---
dict-tree.el | 54 ++++++++++++++++++++++++++----------------------------
1 file changed, 26 insertions(+), 28 deletions(-)
diff --git a/dict-tree.el b/dict-tree.el
index 2278866..8919b45 100644
--- a/dict-tree.el
+++ b/dict-tree.el
@@ -3346,7 +3346,7 @@ extension, suitable for passing to `load-library'."
;; Pretty-print dictionaries during edebug
;; We advise the `edebug-prin1' and `edebug-prin1-to-string' functions
-;; (actually, aliases) so that they pring "#<dict-tree NAME>" instead of
+;; (actually, aliases) so that they print "#<dict-tree NAME>" instead of
;; the full print form for dictionaries.
;;
;; This is because, if left to its own devices, edebug hangs for ages
@@ -3354,6 +3354,10 @@ extension, suitable for passing to `load-library'."
;; *very* long time for it to finish, or kill Emacs entirely. (Even C-g
;; C-g fails!)
;;
+;; We do this also for lists of dictionaries, since those occur quite
+;; often, but not for other sequence types or deeper nested structures,
+;; to keep the implementation as simple as possible.
+;;
;; Since the print form of a dictionary is practically incomprehensible
;; anyway, we don't lose much by doing this. If you *really* want to
;; print dictionaries in full whilst edebugging, despite this warning,
@@ -3373,33 +3377,27 @@ extension, suitable for passing to `load-library'."
(cond
((dictree-p object)
(concat "#<dict-tree \"" (dictree-name object) "\">"))
- ((consp object)
- (if (consp (cdr object))
- (let ((pretty "("))
- (while object
- (setq pretty
- (concat pretty
- (dictree--edebug-pretty-print
- (if (atom object)
- (prog1
- (dictree--edebug-pretty-print object)
- (setq object nil))
- (pop object)))
- (when object " "))))
- (concat pretty ")"))
- (concat "(" (dictree--edebug-pretty-print (car object))
- " . " (dictree--edebug-pretty-print (cdr object)) ")")))
- ((vectorp object)
- (let ((pretty "[") (len (length object)))
- (dotimes (i (1- len))
- (setq pretty
- (concat pretty
- (dictree--edebug-pretty-print (aref object i))
- " ")))
- (concat pretty
- (dictree--edebug-pretty-print (aref object (1- len)))
- "]")))
- (t (prin1-to-string object))))
+ ((let ((dlist object) (test t))
+ (while (or (dictree-p (car-safe dlist))
+ (and dlist (setq test nil)))
+ (setq dlist (cdr dlist)))
+ test)
+ (concat "(" (mapconcat (lambda (d)
+ (concat "#<dict-tree \""
+ (dictree-name d) "\">"))
+ object " ") ")"))
+ ;; ((vectorp object)
+ ;; (let ((pretty "[") (len (length object)))
+ ;; (dotimes (i (1- len))
+ ;; (setq pretty
+ ;; (concat pretty
+ ;; (if (trie-p (aref object i))
+ ;; "#<trie>" (prin1-to-string (aref object i))) " ")))
+ ;; (concat pretty
+ ;; (if (trie-p (aref object (1- len)))
+ ;; "#<trie>" (prin1-to-string (aref object (1- len))))
+ ;; "]")))
+ ))
(ad-define-subr-args 'edebug-prin1 '(object &optional printcharfun))
- [elpa] externals/dict-tree a07802a 057/154: Bug-fix to dictree-load, which was screwing around with dictree-file data, (continued)
- [elpa] externals/dict-tree a07802a 057/154: Bug-fix to dictree-load, which was screwing around with dictree-file data, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree f4aa81c 059/154: Disable caching for unnamed meta-dicts, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree b6175f6 058/154: Bug-fix to meta-dicts: don't add them to meta-dict-lists of constituent lists if caching is disabled,, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree d31ddac 065/154: Bug-fixes to meta-dictionary handling, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree c553822 066/154: Small bug-fix in dictree--do-query, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 15ca12e 069/154: Re-filled to 72 chars/line, for mailing to gnu-emacs-sources list, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree dca8bcd 070/154: Advised edebug-prin1 and edebug-prin1-to-string to prevent edebug hanging, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 5f549f0 073/154: Bug-fixes to dictree--write-meta-dict-code, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 0ef5b58 078/154: Revert "Replaced advice with cedet-edebug.el for pretty-printing", Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree df22e8e 074/154: Bug-fixes to edebug advice, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 3794988 079/154: Simplified advice-based edebug pretty-printing of tries and dictionaries.,
Stefan Monnier <=
- [elpa] externals/dict-tree 238fd6b 082/154: Fixed bug in dictree--merge that caused one too many completions to be cached., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree a256974 086/154: Minor typo-fixes in docstrings., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree d6ea2b5 088/154: Fixed interactive argument handling in predictive-fast-learn-from-buffer., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 39ace6f 094/154: Added autoload cookies., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree a1bff31 096/154: Trivial whitespace tidying., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree e752b53 101/154: Accept symbols for dictionary arguments., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 8aa6047 106/154: Suppress bogus unused lexical variable byte-compiler warnings., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 4b3cc3c 122/154: Do lexbind test at compile-time instead of load-time., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree a4b2a1b 126/154: Improve edebug pretty-printing., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree b7173e8 152/154: Fix lexical binding bugs., Stefan Monnier, 2020/12/14