[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dict-tree 034a2d4 020/154: Fixed dictree-member-p bug;
From: |
Stefan Monnier |
Subject: |
[elpa] externals/dict-tree 034a2d4 020/154: Fixed dictree-member-p bug; dictionaries no longer 'provide' feature. |
Date: |
Mon, 14 Dec 2020 12:21:36 -0500 (EST) |
branch: externals/dict-tree
commit 034a2d42facad828a286a4e8d03503fb750b44e6
Author: Toby Cubitt <toby-predictive@dr-qubit.org>
Commit: tsc25 <toby-predictive@dr-qubit.org>
Fixed dictree-member-p bug; dictionaries no longer 'provide' feature.
---
dict-tree.el | 66 +++++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 41 insertions(+), 25 deletions(-)
diff --git a/dict-tree.el b/dict-tree.el
index f747fd0..7ee5bc1 100644
--- a/dict-tree.el
+++ b/dict-tree.el
@@ -367,6 +367,7 @@ If START or END is negative, it counts from the end."
complete-cache-threshold
complete-ranked-cache-threshold
&aux
+ (dictname (when name (symbol-name name)))
(dictlist
(mapcar
(lambda (dic)
@@ -633,7 +634,7 @@ structure. See `trie-create' for details."
(let ((dict
(dictree--create
- filename name autosave unlisted
+ filename (when name (symbol-name name)) autosave unlisted
comparison-function insert-function rank-function
cache-policy cache-update-policy
lookup-cache-threshold
@@ -646,9 +647,10 @@ structure. See `trie-create' for details."
;; store dictionary in variable NAME
(when name (set name dict))
;; add it to loaded dictionary list, unless it's unlisted
- (unless unlisted
+ (unless (or (null name) unlisted)
(push dict dictree-loaded-list)
- (provide name))
+; (provide name)
+ )
dict))
@@ -766,7 +768,7 @@ underlying data structure. See `trie-create' for details."
(let ((dict
(dictree--create-custom
- filename name autosave unlisted
+ filename (when name (symbol-name name)) autosave unlisted
comparison-function insert-function rank-function
cache-policy cache-update-policy
lookup-cache-threshold
@@ -787,9 +789,10 @@ underlying data structure. See `trie-create' for details."
;; store dictionary in variable NAME
(when name (set name dict))
;; add it to loaded dictionary list, unless it's unlisted
- (unless unlisted
+ (unless (or (null name) unlisted)
(push dict dictree-loaded-list)
- (provide name))
+; (provide name)
+ )
dict))
@@ -823,7 +826,8 @@ The other arguments are as for `dictree-create'."
(let ((dict
(dictree--meta-dict-create
- dictionary-list filename name autosave unlisted
+ dictionary-list filename (when name (symbol-name name))
+ autosave unlisted
combine-function
cache-policy cache-update-policy
lookup-cache-threshold
@@ -833,9 +837,10 @@ The other arguments are as for `dictree-create'."
;; store dictionary in variable NAME
(when name (set name dict))
;; add it to loaded dictionary list, unless it's unlisted
- (unless unlisted
+ (unless (or (null name) unlisted)
(push dict dictree-loaded-list)
- (provide name))
+; (provide name)
+ )
;; update meta-dict-list cells of constituent dictionaries
(mapc
(lambda (dic)
@@ -1226,7 +1231,7 @@ is ignored in that case)."
;; ----------------------------------------------------------------
;; Retrieving data
-(defun dictree-lookup (dict key &optional nilflag)
+(defun dictree-member (dict key &optional nilflag)
"Return the data associated with KEY in dictionary DICT,
or nil if KEY is not in the dictionary.
@@ -1235,11 +1240,12 @@ nil if KEY does not exist in TREE. This allows a
non-existent KEY
to be distinguished from an element with a null association. (See
also `dictree-member-p' for testing existence alone.)"
(let ((data (dictree--lookup dict key nilflag)))
- (unless (eq data nilflag)
+ (if (eq data nilflag)
+ nilflag
(dictree--cell-data data))))
-(defalias 'dictree-member 'dictree-lookup)
+(defalias 'dictree-lookup 'dictree-member)
(defun dictree-member-p (dict key)
@@ -2162,8 +2168,7 @@ NOT be saved even if its autosave flag is set."
(format
"Dictionary %s modified. Save before unloading? "
(dictree-name dict))))))
- (dictree-save dict)
- (setf (dictree-modified dict) nil))
+ (dictree-save dict))
;; if unloading a meta-dict, remove reference to it from constituent
;; dictionaries' meta-dict-list cell
@@ -2395,16 +2400,26 @@ NOT be saved even if its autosave flag is set."
(setf (dictree--meta-dict-list tmpdict) nil)
;; write lisp code that generates the dictionary object
- (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")
- (insert hashcode)
- (insert "(setf (dictree-filename " dictname ")\n"
- " (locate-library \"" dictname "\"))\n")
- (insert "(unless (memq " dictname " dictree-loaded-list)\n"
- " (push " dictname " dictree-loaded-list))\n")
- (insert "(provide '" dictname ")\n")))
+ (let ((restore-print-circle print-circle)
+ (restore-print-level print-level)
+ (restore-print-length print-length))
+ (setq print-circle nil
+ print-level nil
+ print-length nil)
+ (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")
+ (insert hashcode)
+ (insert "(setf (dictree-filename " dictname ")\n"
+ " (locate-library \"" dictname "\"))\n")
+ (insert "(unless (memq " dictname " dictree-loaded-list)\n"
+ " (push " dictname " dictree-loaded-list))\n")
+; (insert "(provide '" dictname ")\n")
+ (setq print-circle restore-print-circle
+ print-level restore-print-level
+ print-length restore-print-length)
+ )))
@@ -2514,7 +2529,8 @@ giving it the name DICTNAME."
" (locate-library \"" dictname "\"))\n")
(insert "(unless (memq " dictname " dictree-loaded-list)"
" (push " dictname " dictree-loaded-list))\n")
- (insert "(provide '" dictname ")\n")))
+; (insert "(provide '" dictname ")\n")
+ ))
- [elpa] externals/dict-tree 608fcd4 049/154: Bug-fix to dictree--write-dict-code, (continued)
- [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, 2020/12/14
- [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 <=
- [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
- [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