[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dict-tree 4722fcb 100/154: Modified read-dict to return
From: |
Stefan Monnier |
Subject: |
[elpa] externals/dict-tree 4722fcb 100/154: Modified read-dict to return dictionary name instead of dictionary. |
Date: |
Mon, 14 Dec 2020 12:21:53 -0500 (EST) |
branch: externals/dict-tree
commit 4722fcba214c9e2e5487f2dae582ed8aaaa4e0c9
Author: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Commit: Toby S. Cubitt <toby-predictive@dr-qubit.org>
Modified read-dict to return dictionary name instead of dictionary.
Also modified all interactive dictionary commands accordingly. This avoids
the
full eval'ed dictionary ending up in the command-history.
---
dict-tree.el | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/dict-tree.el b/dict-tree.el
index 280ee01..d640bd3 100644
--- a/dict-tree.el
+++ b/dict-tree.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2004-2012 Free Software Foundation, Inc
;; Author: Toby Cubitt <toby-predictive@dr-qubit.org>
-;; Version: 0.12.7
+;; Version: 0.12.8
;; Keywords: extensions, matching, data structures
;; trie, tree, dictionary, completion, regexp
;; Package-Requires: ((trie "0.2.5") (tNFA "0.1.1") (heap "0.3"))
@@ -50,6 +50,12 @@
;;; Change Log:
;;
+;; Version 0.12.8
+;; * modified `read-dict' to return dictionary name instead of dictionary
+;; itself, even for loaded dictionaries, to avoid dictionary itself ending
+;; up in `command-history'
+;; * updated interactive dictionary commands accordingly
+;;
;; Version 0.12.7
;; * create defstruct copier functions for dict-trees and meta-dict-trees
;; * don't transform hash tables to alists when writing dictionaries if
@@ -1579,6 +1585,8 @@ PREFIX is a prefix of STR."
(defun dictree-clear-caches (dict)
"Clear all DICT's query caches."
(interactive (list (read-dict "Dictionary: ")))
+ (when (and (called-interactively-p 'any) (symbolp dict))
+ (setq dict (eval dict)))
(dolist (cachefun '(dictree-lookup-cache
dictree-complete-cache
dictree-complete-ranked-cache
@@ -1914,6 +1922,8 @@ bind any variables with names commencing \"--\"."
"Return the number of entries in dictionary DICT.
Interactively, DICT is read from the mini-buffer."
(interactive (list (read-dict "Dictionary: ")))
+ (when (and (called-interactively-p 'any) (symbolp dict))
+ (setq dict (eval dict)))
(let ((count 0))
(dictree-mapc (lambda (&rest dummy) (incf count)) dict)
(when (called-interactively-p 'interactive)
@@ -2570,9 +2580,10 @@ both forms. See `dictree-write'.
Interactively, DICT is read from the mini-buffer."
(interactive (list (read-dict "Dictionary: ")))
+ (when (and (called-interactively-p 'any) (symbolp dict))
+ (setq dict (eval dict)))
(let ((filename (dictree-filename dict)))
-
;; if dictionary has no associated file, prompt for one
(unless (and filename (> (length filename) 0))
(setq filename
@@ -2617,6 +2628,8 @@ and OVERWRITE is the prefix argument."
(read-file-name "Write dictionary to file: "
nil "")
current-prefix-arg))
+ (when (and (called-interactively-p 'any) (symbolp dict))
+ (setq dict (eval dict)))
;; default to DICT's current file, if any
(when (or (null filename)
(and (called-interactively-p 'any) (string= filename "")))
@@ -2782,7 +2795,7 @@ Interactively, FILE is read from the mini-buffer."
(interactive (list (read-dict "Load dictionary: " nil nil t t)))
;; sort out dictionary name and file name
- (if (dictree-p file)
+ (if (or (symbolp file) (dictree-p file))
(message "Dictionary %s already loaded" (dictree-name file))
;; load the dictionary
@@ -2833,6 +2846,8 @@ Interactively, DICT is read from the mini-buffer, and
DONT-SAVE
is the prefix argument."
(interactive (list (read-dict "Dictionary: ")
current-prefix-arg))
+ (when (and (called-interactively-p 'any) (symbolp dict))
+ (setq dict (eval dict)))
;; if dictionary has been modified, autosave is set and not overidden,
;; save it first
@@ -3175,6 +3190,8 @@ are created when using a trie that is not self-balancing,
see
(interactive (list (read-dict "Dictionary: ")
(read-file-name "File to populate from: "
nil "" t)))
+ (when (and (called-interactively-p 'any) (symbolp dict))
+ (setq dict (eval dict)))
(if (and (called-interactively-p 'any) (string= file ""))
(message "No file specified; dictionary %s NOT populated"
@@ -3324,6 +3341,8 @@ TYPE is always 'string."
"Buffer to dump to (defaults to current): "
(buffer-name (current-buffer)))
'string))
+ (when (and (called-interactively-p 'any) (symbolp dict))
+ (setq dict (eval dict)))
;; select the buffer, creating it if necessary
(if buffer
@@ -3390,6 +3409,8 @@ Interactively, DICT and FILE are read from the
mini-buffer,
OVERWRITE is the prefix argument, and TYPE is always 'string."
(interactive (list (read-dict "Dictionary: ")
(read-file-name "File to dump to: " nil "")))
+ (when (and (called-interactively-p 'any) (symbolp dict))
+ (setq dict (eval dict)))
(if (and (called-interactively-p 'any) (string= filename ""))
(message "Dictionary %s NOT dumped" (dictree-name dict))
@@ -3483,7 +3504,7 @@ extension, suitable for passing to `load-library'."
((condition-case nil
(dictree-p (eval (intern-soft dictname)))
(void-variable nil))
- (eval (intern-soft dictname)))
+ (intern-soft dictname))
;; if user selected an unloaded dictionary, return dict name
((and allow-unloaded (stringp dictname)) dictname)
;; if DEFAULT was specified, return that
- [elpa] externals/dict-tree 1d096b1 141/154: Myriad bug fixes and code refactoring in new fuzzy and ngram completion., (continued)
- [elpa] externals/dict-tree 1d096b1 141/154: Myriad bug fixes and code refactoring in new fuzzy and ngram completion., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 572c746 149/154: Fix byte-compilation errors and warnings., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 3ddde93 143/154: Switch to keyword arguments for trie/dictree query functions., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 1030ae2 071/154: Require advice when compiling, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 7a51b21 083/154: Fixed dictree--update-cache to work for lists of prefixes., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 50ae73e 085/154: Fixed bug in Read-Dict preventing completion on dict files in load-path., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree bc5724e 080/154: Minor bug-fixes to [trie/dict-tree]--edebug-pretty-print, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree f0396a0 087/154: Fixed bugs in synchronisation of regexp query caches., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 18ede82 089/154: Fixed minor spelling errors in docstrings., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree a9344ec 093/154: Updated Package-Version, Package-Requires, and Keywords package headers., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 4722fcb 100/154: Modified read-dict to return dictionary name instead of dictionary.,
Stefan Monnier <=
- [elpa] externals/dict-tree d325841 009/154: Dictionaries are now saved in both compiled and uncompiled forms., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 753904c 034/154: Added functions for pushing things onto dictree and trie stacks, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree b3eb0f1 031/154: Bug-fix to dictree-insert, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 0774b51 048/154: Added support for wildcard searches, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 06f5039 055/154: Bug-fix to 'resultfun' feature in dictree--query and dictree--do-query, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 9e9d7e9 056/154: Added dictree-clear-caches for doing the obvious, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 32bb6e2 061/154: Replaced wildcard searches with more powerful and efficient regexp searches., Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree aa22866 062/154: minor fix: added tNFA to required packages, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree c53e4b8 064/154: Bumped copyright year, Stefan Monnier, 2020/12/14
- [elpa] externals/dict-tree 61f0ce6 068/154: Bug-fix in dictree--query, Stefan Monnier, 2020/12/14