[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dict-tree 1ec9d58 102/154: Restore trie print/read tran
From: |
Stefan Monnier |
Subject: |
[elpa] externals/dict-tree 1ec9d58 102/154: Restore trie print/read transformer functions. |
Date: |
Mon, 14 Dec 2020 12:21:54 -0500 (EST) |
branch: externals/dict-tree
commit 1ec9d58a671b13b6a106533c485b0d4fbc8ff13d
Author: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Restore trie print/read transformer functions.
Byte-compilation of the (mildly) circular avl-tree structures currently
appears to flatten the data structure, thereby massively bloating the
size of the byte-compiled version.
---
dict-tree.el | 44 +++++++++++++++++++++++++++-----------------
1 file changed, 27 insertions(+), 17 deletions(-)
diff --git a/dict-tree.el b/dict-tree.el
index 48864f0..50964777 100644
--- a/dict-tree.el
+++ b/dict-tree.el
@@ -2657,8 +2657,7 @@ and OVERWRITE is the prefix argument."
(find-file-noselect
(setq tmpfile (make-temp-file dictname))))
(set-buffer buff)
- ;; call the appropriate write function to write the dictionary
- ;; code
+ ;; call the appropriate write function to write the dictionary code
(if (dictree--meta-dict-p dict)
(dictree--write-meta-dict-code dict dictname filename)
(dictree--write-dict-code dict dictname filename))
@@ -2684,11 +2683,9 @@ and OVERWRITE is the prefix argument."
;; destination
(unless (eq compilation 'uncompiled)
(if (save-window-excursion
- (let ((restore byte-compile-disable-print-circle)
+ (let ((byte-compile-disable-print-circle t)
err)
- (setq byte-compile-disable-print-circle t)
(setq err (byte-compile-file tmpfile))
- (setq byte-compile-disable-print-circle restore)
err))
(rename-file (concat tmpfile ".elc")
(concat filename ".elc") t)
@@ -3042,7 +3039,20 @@ is the prefix argument."
(insert "(eval-when-compile (require 'cl))\n")
(insert "(require 'dict-tree)\n")
(insert "(defvar " dictname " nil \"Dictionary " dictname ".\")\n")
- (insert "(setq " dictname " " (prin1-to-string tmpdict) ")\n")
+ (unwind-protect
+ (progn
+ ;; transform trie to print form
+ (trie-transform-for-print (dictree--trie tmpdict))
+ (insert "(setq " dictname
+ " '" (prin1-to-string tmpdict) ")\n"))
+ ;; if dictionary doesn't use any custom save functions, tmpdict's trie
+ ;; is identical to original dict, so transform it back to usable form
+ ;; on write error
+ (unless (or (dictree--data-savefun dict)
+ (dictree--plist-savefun dict))
+ (trie-transform-from-read (dictree--trie tmpdict))))
+ (insert "(trie-transform-from-read (dictree--trie "
+ dictname "))\n")
(when hashcode (insert hashcode))
(insert "(unless (memq " dictname " dictree-loaded-list)\n"
" (push " dictname " dictree-loaded-list))\n"))))
@@ -3560,17 +3570,17 @@ extension, suitable for passing to `load-library'."
(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))))
- ;; "]")))
+;; ((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))))
+;; "]")))
))
- [elpa] externals/dict-tree 8810d3e 076/154: Bug-fixes to edebug pretty-print functions., (continued)
- [elpa] externals/dict-tree 8810d3e 076/154: Bug-fixes to edebug pretty-print functions., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree c1eeabe 081/154: Made dictionary auto-saving more robust against dictionary save failures., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 2666377 084/154: Fixed implementation of 'both cache policy., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 5cc5449 091/154: Fixed obsolete functions and other compiler warnings., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 0ea66e7 090/154: Added fboundp guard around ad-define-subr-args (removed in Emacs-24)., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree cfdc73d 099/154: Fixed calls to dictree-create-meta-dict., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 2a1d749 098/154: Minor change to package description, to match other data structure packages., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 7ab8f94 095/154: Updated copyright attribution and license (GPL2 -> GPL3)., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 09b388f 108/154: Add note to self to use cust-print pretty-printing instead of advice., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree d96b1c5 097/154: More minor whitespace and commentary changes., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 1ec9d58 102/154: Restore trie print/read transformer functions.,
Stefan Monnier <=
- [elpa] externals/dict-tree 48ab389 092/154: Simplified persistent-storage code for tries and dict-trees., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 454c68b 109/154: Code cleanup., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree ba2eba0 107/154: Exploit lexical closures to allow byte-compilation of wrapped functions., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 08303f3 103/154: Remove ChangeLogs from library headers., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 8d8ce4f 120/154: Print dict-tree cache sizes in edebug., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 84b23ec 112/154: Implement trie-fuzzy-match and trie-fuzzy-complete functions., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 5321c25 113/154: Implement fuzzy match and completion on dict-trees., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree d0e339d 117/154: Don't wrap rank and filter functions for regexp and fuzzy queries., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree a11f2a5 115/154: Update predictive mode to new dictree-create function interface., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 217c9d2 119/154: Updated Commentary., Stefan Monnier, 2020/12/14