[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dict-tree dca8bcd 070/154: Advised edebug-prin1 and ede
From: |
Stefan Monnier |
Subject: |
[elpa] externals/dict-tree dca8bcd 070/154: Advised edebug-prin1 and edebug-prin1-to-string to prevent edebug hanging |
Date: |
Mon, 14 Dec 2020 12:21:47 -0500 (EST) |
branch: externals/dict-tree
commit dca8bcdb34cb55846d3c449ba60eb8508e3452ef
Author: Toby Cubitt <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Advised edebug-prin1 and edebug-prin1-to-string to prevent edebug hanging
whilst printing large data structures - finally!
---
dict-tree.el | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 56 insertions(+), 5 deletions(-)
diff --git a/dict-tree.el b/dict-tree.el
index ad84b26..a5bf170 100644
--- a/dict-tree.el
+++ b/dict-tree.el
@@ -5,7 +5,7 @@
;; Copyright (C) 2004-2009 Toby Cubitt
;; Author: Toby Cubitt <toby-predictive@dr-qubit.org>
-;; Version: 0.12
+;; Version: 0.12.1
;; Keywords: dictionary, tree
;; URL: http://www.dr-qubit.org/emacs.php
@@ -53,6 +53,10 @@
;;; Change log:
;;
+;; Version 0.12.1
+;; * added `edebug-prin1' and `edebug-prin1-to-string' advice to prevent
+;; edebug hanging whilst printing large dictionaries
+;;
;; Version 0.12
;; * complete rewrite using new trie.el library
;;
@@ -3268,10 +3272,10 @@ supplied, only complete on dictionaries in that list.
If ALLOW-UNLOADED is non-nil, also complete on the names of
unloaded dictionaries (actually, on any Elisp file in the current
-`load-path' restricted to subdirectories of your home
-directory). If an unloaded dictionary is read, the name of the
-Elisp file will be returned, without extension, suitable for
-passing to `load-library'."
+`load-path' restricted to subdirectories of your home directory
+whose file name starts with \"dict-\"). If an unloaded dictionary
+is read, the name of the Elisp file will be returned, without
+extension, suitable for passing to `load-library'."
(let (dictname paths)
;; when allowing unloaded dictionaries...
@@ -3327,6 +3331,53 @@ 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.
+;;
+;; 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.
+
+
+(eval-when-compile (require 'edebug))
+
+
+(ad-define-subr-args 'edebug-prin1 '(object &optional printcharfun))
+
+(defadvice edebug-prin1
+ (around dictree activate compile preactivate)
+ (if (dictree-p object)
+ (let ((pretty (concat "#<dict-tree " (dictree-name object) ">")))
+ (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)
+ (if (dictree-p object)
+ (setq ad-return-value
+ (concat "#<dict-tree " (dictree-name object) ">"))
+ ad-do-it))
+
+
+
(provide 'dict-tree)
- [elpa] externals/dict-tree 7a5d669 044/154: Allow insertion and load functions to be overriden in dictree-populate-from-file,, (continued)
- [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
- [elpa] externals/dict-tree 4a77581 046/154: Tidied up dictree--query and related code, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree eccfe92 047/154: Bug fix in dictree--do-query, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree f6e9ba1 054/154: Added optional RESULTFUN argument to trie query functions,, Stefan Monnier, 2020/12/14
- [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 <=
- [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, 2020/12/14
- [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