[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dict-tree 920d959 077/154: Replaced advice with cedet-e
From: |
Stefan Monnier |
Subject: |
[elpa] externals/dict-tree 920d959 077/154: Replaced advice with cedet-edebug.el for pretty-printing |
Date: |
Mon, 14 Dec 2020 12:21:48 -0500 (EST) |
branch: externals/dict-tree
commit 920d9594655c77fd5d5eb331e81a8b0ab8b417cc
Author: tsc25 <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Replaced advice with cedet-edebug.el for pretty-printing
tries and dictionaries in edebug.
---
dict-tree.el | 80 +++++++-----------------------------------------------------
1 file changed, 9 insertions(+), 71 deletions(-)
diff --git a/dict-tree.el b/dict-tree.el
index 2278866..6d5ad4d 100644
--- a/dict-tree.el
+++ b/dict-tree.el
@@ -3345,89 +3345,27 @@ 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
-;; the full print form for dictionaries.
+;; We use `cedet-edebug-add-print-override' from cedet-edebug.el to make
+;; edebug print "#<dict-tree NAME>" instead of the full print form for
+;; dictionaries. (This is cleaner than using aliases or advice.)
;;
;; This is because, if left to its own devices, edebug hangs for ages
;; whilst printing large dictionaries, and you either have to wait for a
;; *very* long time for it to finish, or kill Emacs entirely. (Even C-g
-;; C-g fails!)
-;;
-;; 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,
-;; disable the advice.
-;;
-;; FIXME: Should use `cedet-edebug-prin1-extensions' instead of advice
-;; when `cedet-edebug' is loaded, though I believe this still
-;; works in that case.
+;; C-g fails!) Since the print form of a dictionary is practically
+;; incomprehensible anyway, we don't lose much by doing this.
+(require 'cedet-edebug)
-(eval-when-compile
- (require 'edebug)
- (require 'advice))
+(defun dictree-pretty-print (dict)
+ (concat "#<dict-tree \"" (dictree--name dict) "\">"))
-
-(defun dictree--edebug-pretty-print (object)
- (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))))
-
-
-(ad-define-subr-args 'edebug-prin1 '(object &optional printcharfun))
-
-(defadvice edebug-prin1
- (around dictree activate compile preactivate)
- (let ((pretty (dictree--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 dictree activate compile preactivate)
- (let ((pretty (dictree--edebug-pretty-print object)))
- (if pretty
- (setq ad-return-value pretty)
- ad-do-it)))
+(cedet-edebug-add-print-override 'dictree-p 'dictree-pretty-print)
(provide 'dict-tree)
-
;;; Local Variables:
;;; fill-column: 72
;;; End:
- [elpa] externals/dict-tree 5834dac 036/154: Replaced bare avl-trees, (continued)
- [elpa] externals/dict-tree 5834dac 036/154: Replaced bare avl-trees, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 673fd2a 029/154: Abstract away the setcar used to set the data component of a cell, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 2700e21 035/154: Don't compile wrapped functions explicitly, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 70f99ee 037/154: Make certain dictionary commands (mostly saving and loading) interactive again., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 35346a4 041/154: Bug-fix in dictree--write-dict-code, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 608fcd4 049/154: Bug-fix to dictree--write-dict-code, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 179c0b5 045/154: Bug-fix to messages displayed by dictree-populate-from-file, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 6b24547 052/154: Allow "]" to be included in a negated character alternatives, by placing immediately after the "[^"., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree a61f90e 053/154: Bug-fix in dictree-wildcard-search, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree b33203a 060/154: Manage loading and unloading of dictionaries automatically in predictive-mode, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 920d959 077/154: Replaced advice with cedet-edebug.el for pretty-printing,
Stefan Monnier <=
- [elpa] externals/dict-tree 9946a1d 075/154: Dictionary now defaults to current dict in in most dictionary-related commands., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree aa1a45d 105/154: Enable lexical binding, and fix issues it picks up., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree ce48d61 104/154: Use symbol-value instead of eval., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 9eb7d29 014/154: Bumped version number and updated commentary., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 034a2d4 020/154: Fixed dictree-member-p bug; dictionaries no longer 'provide' feature., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 104fd29 022/154: Roll back changes to read-dict - not clear that they're necessary even under windoze, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 6b05d61 025/154: Another bug-fix to the new cache policy code, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree daad3f1 040/154: Fixed bugs in dictree--write-dict-code and dictree-save, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 0aed5d4 043/154: Modified dictree--read-line to call data and plist load functions with null argument, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 7a5d669 044/154: Allow insertion and load functions to be overriden in dictree-populate-from-file,, Stefan Monnier, 2020/12/14