[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 6aefb0b 05/62: Made dictionary names strings
From: |
Ian Dunn |
Subject: |
[elpa] master 6aefb0b 05/62: Made dictionary names strings |
Date: |
Sat, 9 Dec 2017 14:33:56 -0500 (EST) |
branch: master
commit 6aefb0bd07cb313f5169696a6dfffb60d3ae68b3
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>
Made dictionary names strings
* paced.el (paced-named-dictionary): Use 'equal to compare keys.
(paced-read-dictionary): Don't intern result.
(paced-dictionary-registered-p): Use 'equal to compare keys.
(paced-register-dictionary): Use 'equal to compare keys.
(paced-create-new-dictionary): Don't intern name.
* paced-tests.el: Update tests.
---
paced-tests.el | 70 +++++++++++++++++++++++++++++-----------------------------
paced.el | 12 +++++-----
test.mk | 4 ++--
3 files changed, 43 insertions(+), 43 deletions(-)
diff --git a/paced-tests.el b/paced-tests.el
index c05a52c..70ff440 100644
--- a/paced-tests.el
+++ b/paced-tests.el
@@ -43,7 +43,7 @@
(target-file-exists (file-exists-p paced-test-dict-save-file))
(old-mod-time (and target-file-exists
(file-attribute-modification-time (file-attributes
paced-test-dict-save-file))))
- (new-dict (paced-make-dictionary 'test-dict-case
+ (new-dict (paced-make-dictionary "test-dict-case"
paced-test-dict-save-file
t)))
(should (= (length paced--registered-dictionaries) 1))
@@ -61,15 +61,15 @@
(let* ((paced--registered-dictionaries nil))
(paced-load-dictionary-from-file paced-test-dict-save-file)
(should (= (length paced--registered-dictionaries) 1))
- (should (map-contains-key paced--registered-dictionaries 'test-dict-case))
- (should (paced-dictionary-p (map-elt paced--registered-dictionaries
'test-dict-case)))))
+ (should (map-contains-key paced--registered-dictionaries "test-dict-case"))
+ (should (paced-dictionary-p (map-elt paced--registered-dictionaries
"test-dict-case" nil 'string-equal)))))
(defvar paced-test-enable-symbol nil)
(ert-deftest paced-enable-list-symbol ()
"Test case for `paced-dictionary-enable-alist' being an arbitrary symbol."
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '((paced-test-enable-symbol .
test-dict-case)))
+ (paced-global-dict-enable-alist '((paced-test-enable-symbol .
"test-dict-case")))
(new-buffer (find-file-noselect paced-first-test-file)))
(paced-load-dictionary-from-file paced-test-dict-save-file)
(with-current-buffer new-buffer
@@ -77,13 +77,13 @@
(should-not (paced-current-dictionary))
(setq-local paced-test-enable-symbol t)
(should (paced-dictionary-p (paced-current-dictionary)))
- (should (eq (paced-dictionary-name (paced-current-dictionary))
'test-dict-case)))
+ (should (string-equal (paced-dictionary-name (paced-current-dictionary))
"test-dict-case")))
(kill-buffer new-buffer)))
(ert-deftest paced-enable-list-mode ()
"Test case for `paced-dictionary-enable-alist' being a mode symbol."
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '((text-mode . test-dict-case)))
+ (paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(buffer-one (find-file-noselect paced-first-test-file))
(buffer-two (find-file-noselect paced-second-test-file)))
(paced-load-dictionary-from-file paced-test-dict-save-file)
@@ -92,7 +92,7 @@
(kill-buffer buffer-two)
(with-current-buffer buffer-one
(should (paced-dictionary-p (paced-current-dictionary)))
- (should (eq (paced-dictionary-name (paced-current-dictionary))
'test-dict-case)))
+ (should (string-equal (paced-dictionary-name (paced-current-dictionary))
"test-dict-case")))
(kill-buffer buffer-one)))
(defun paced-test-function-symbol ()
@@ -101,7 +101,7 @@
(ert-deftest paced-enable-list-function-symbol ()
"Test case for `paced-dictionary-enable-alist' being a function symbol."
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '((paced-test-function-symbol .
test-dict-case)))
+ (paced-global-dict-enable-alist '((paced-test-function-symbol .
"test-dict-case")))
(buffer-one (find-file-noselect paced-first-test-file)))
(paced-load-dictionary-from-file paced-test-dict-save-file)
(with-current-buffer buffer-one
@@ -109,13 +109,13 @@
(should-not (paced-current-dictionary))
(setq-local paced-test-enable-symbol t)
(should (paced-dictionary-p (paced-current-dictionary)))
- (should (eq (paced-dictionary-name (paced-current-dictionary))
'test-dict-case)))
+ (should (string-equal (paced-dictionary-name (paced-current-dictionary))
"test-dict-case")))
(kill-buffer buffer-one)))
(ert-deftest paced-enable-list-lambda-function ()
"Test case for `paced-dictionary-enable-alist' being a lambda form."
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '(((lambda nil
paced-test-enable-symbol) . test-dict-case)))
+ (paced-global-dict-enable-alist '(((lambda nil
paced-test-enable-symbol) . "test-dict-case")))
(buffer-one (find-file-noselect paced-first-test-file)))
(paced-load-dictionary-from-file paced-test-dict-save-file)
(with-current-buffer buffer-one
@@ -123,13 +123,13 @@
(should-not (paced-current-dictionary))
(setq-local paced-test-enable-symbol t)
(should (paced-dictionary-p (paced-current-dictionary)))
- (should (eq (paced-dictionary-name (paced-current-dictionary))
'test-dict-case)))
+ (should (string-equal (paced-dictionary-name (paced-current-dictionary))
"test-dict-case")))
(kill-buffer buffer-one)))
(ert-deftest paced-enable-list-and-form ()
"Test case for `paced-dictionary-enable-alist' being an 'and' form."
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '(((and text-mode
paced-test-enable-symbol) . test-dict-case)))
+ (paced-global-dict-enable-alist '(((and text-mode
paced-test-enable-symbol) . "test-dict-case")))
(buffer-one (find-file-noselect paced-first-test-file))
(buffer-two (find-file-noselect paced-second-test-file)))
(paced-load-dictionary-from-file paced-test-dict-save-file)
@@ -144,13 +144,13 @@
(should-not (paced-current-dictionary))
(setq-local paced-test-enable-symbol t)
(should (paced-dictionary-p (paced-current-dictionary)))
- (should (eq (paced-dictionary-name (paced-current-dictionary))
'test-dict-case)))
+ (should (string-equal (paced-dictionary-name (paced-current-dictionary))
"test-dict-case")))
(kill-buffer buffer-one)))
(ert-deftest paced-enable-list-or-form ()
"Test case for `paced-dictionary-enable-alist' being an 'or' form."
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '(((or text-mode
paced-test-enable-symbol) . test-dict-case)))
+ (paced-global-dict-enable-alist '(((or text-mode
paced-test-enable-symbol) . "test-dict-case")))
(buffer-one (find-file-noselect paced-first-test-file))
(buffer-two (find-file-noselect paced-second-test-file)))
(paced-load-dictionary-from-file paced-test-dict-save-file)
@@ -159,25 +159,25 @@
(should-not (paced-current-dictionary))
(setq-local paced-test-enable-symbol t)
(should (paced-dictionary-p (paced-current-dictionary)))
- (should (eq (paced-dictionary-name (paced-current-dictionary))
'test-dict-case)))
+ (should (string-equal (paced-dictionary-name (paced-current-dictionary))
"test-dict-case")))
(kill-buffer buffer-two)
(with-current-buffer buffer-one
(setq-local paced-test-enable-symbol nil)
(should (paced-dictionary-p (paced-current-dictionary)))
- (should (eq (paced-dictionary-name (paced-current-dictionary))
'test-dict-case))
+ (should (string-equal (paced-dictionary-name (paced-current-dictionary))
"test-dict-case"))
(setq-local paced-test-enable-symbol t)
(should (paced-dictionary-p (paced-current-dictionary)))
- (should (eq (paced-dictionary-name (paced-current-dictionary))
'test-dict-case)))
+ (should (string-equal (paced-dictionary-name (paced-current-dictionary))
"test-dict-case")))
(kill-buffer buffer-one)))
(ert-deftest paced-populate-file ()
"Test case for single file populator."
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '((text-mode . test-dict-case)))
+ (paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(cmd (paced-file-population-command :file paced-first-test-file))
test-dict)
(paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary 'test-dict-case))
+ (setq test-dict (paced-named-dictionary "test-dict-case"))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-repopulate-dictionary test-dict)
@@ -192,13 +192,13 @@
(ert-deftest paced-populate-buffer ()
"Test case for single buffer populator."
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '((text-mode . test-dict-case)))
+ (paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(buffer "first.txt")
(buffer-one (find-file-noselect paced-first-test-file))
(cmd (paced-buffer-population-command :buffer buffer))
test-dict)
(paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary 'test-dict-case))
+ (setq test-dict (paced-named-dictionary "test-dict-case"))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-repopulate-dictionary test-dict)
@@ -214,13 +214,13 @@
(ert-deftest paced-populate-file-function ()
"Test case for file-function populator."
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '((text-mode . test-dict-case)))
+ (paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(pre-func (lambda () (insert (buffer-string)) t))
(cmd (paced-file-function-population-command :file
paced-first-test-file
:setup-func pre-func))
test-dict)
(paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary 'test-dict-case))
+ (setq test-dict (paced-named-dictionary "test-dict-case"))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-repopulate-dictionary test-dict)
@@ -235,13 +235,13 @@
(ert-deftest paced-populate-directory-regexp ()
"Test case for directory-regexp populator."
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '((text-mode . test-dict-case)))
+ (paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(cmd (paced-directory-regexp-population-command :directory
paced-test-dir
:regexp ".*\\.txt"
:recursive t))
test-dict)
(paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary 'test-dict-case))
+ (setq test-dict (paced-named-dictionary "test-dict-case"))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-repopulate-dictionary test-dict)
@@ -256,12 +256,12 @@
(ert-deftest paced-populate-file-list ()
"Test case for file-list populator."
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '((text-mode . test-dict-case)))
+ (paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(file-list (lambda () `(,paced-first-test-file)))
(cmd (paced-file-list-population-command :generator file-list))
test-dict)
(paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary 'test-dict-case))
+ (setq test-dict (paced-named-dictionary "test-dict-case"))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-repopulate-dictionary test-dict)
@@ -275,12 +275,12 @@
(ert-deftest paced-multiple-population-commands ()
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '((text-mode . test-dict-case)))
+ (paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(cmd1 (paced-file-population-command :file paced-first-test-file))
(cmd2 (paced-file-population-command :file paced-third-test-file))
test-dict)
(paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary 'test-dict-case))
+ (setq test-dict (paced-named-dictionary "test-dict-case"))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd1 cmd2))
(paced-repopulate-dictionary test-dict)
@@ -297,14 +297,14 @@
(ert-deftest paced-populator-settings ()
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '((text-mode . test-dict-case)))
+ (paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(exclude-command (lambda nil (nth 8 (syntax-ppss)))) ;; exclude
comments
(cmd1 (paced-file-population-command :file paced-first-test-file))
(cmd2 (paced-file-population-command :file paced-second-test-file
:props `((paced-exclude-function
quote ,exclude-command))))
test-dict)
(paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary 'test-dict-case))
+ (setq test-dict (paced-named-dictionary "test-dict-case"))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd1 cmd2))
(paced-repopulate-dictionary test-dict)
@@ -319,11 +319,11 @@
(ert-deftest paced-populate-sort-order ()
"Test case for sorting after population."
(let* ((paced--registered-dictionaries nil)
- (paced-global-dict-enable-alist '((text-mode . test-dict-case)))
+ (paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
(cmd (paced-file-population-command :file paced-first-test-file))
test-dict)
(paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary 'test-dict-case))
+ (setq test-dict (paced-named-dictionary "test-dict-case"))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-repopulate-dictionary test-dict)
@@ -341,7 +341,7 @@
(cmd (paced-file-population-command :file file))
test-dict)
(paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary 'test-dict-case))
+ (setq test-dict (paced-named-dictionary "test-dict-case"))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-repopulate-dictionary test-dict)
@@ -354,7 +354,7 @@
(cmd (paced-buffer-population-command :buffer buffer))
test-dict)
(paced-load-dictionary-from-file paced-test-dict-save-file)
- (setq test-dict (paced-named-dictionary 'test-dict-case))
+ (setq test-dict (paced-named-dictionary "test-dict-case"))
(should (paced-dictionary-p test-dict))
(oset test-dict population-commands (list cmd))
(paced-repopulate-dictionary test-dict)
diff --git a/paced.el b/paced.el
index 0409cc9..963441a 100644
--- a/paced.el
+++ b/paced.el
@@ -151,6 +151,7 @@ When nil, \"This\" will be the same as \"this\" in
`usage-hash'.")
:initform 'paced--default-dictionary-sort-func
:type function
:label "Sort Method"
+ :custom function
:documentation "Method by which this dictionary should sort
its usage table.
This should be a function of one argument, the usage-hash slot,
@@ -166,23 +167,23 @@ Do not edit this list manually. Use
`paced-make-dictionary'
instead.")
(defsubst paced-named-dictionary (key)
- (map-elt paced--registered-dictionaries key nil))
+ (map-elt paced--registered-dictionaries key nil 'equal))
(defsubst paced-dictionary-names ()
(map-keys paced--registered-dictionaries))
(defsubst paced-read-dictionary ()
- (intern (completing-read "Dictionary: " (map-keys
paced--registered-dictionaries))))
+ (completing-read "Dictionary: " (map-keys paced--registered-dictionaries)))
(defsubst paced-dictionary-registered-p (key)
- (map-contains-key paced--registered-dictionaries key))
+ (map-contains-key paced--registered-dictionaries key 'equal))
(defsubst paced-ensure-registered (key)
(unless (paced-dictionary-registered-p key)
(error "No paced dictionary called '%s' has been registered." key)))
(defsubst paced-register-dictionary (key dict)
- (map-put paced--registered-dictionaries key dict))
+ (map-put paced--registered-dictionaries key dict 'equal))
(defsubst paced--ensure-dictionary-directory ()
(make-directory paced-dictionary-directory t))
@@ -211,7 +212,7 @@ FILE is the file in which to store the new dictionary.
Once named, the dictionary can be edited through the EIEIO
customization interface."
(declare (interactive-only paced-make-dictionary))
- (interactive (list (intern (read-string "Name: "))
+ (interactive (list (read-string "Name: ")
(read-file-name "Storage File: "
paced-dictionary-directory)))
(let ((new-dict (paced-dictionary :object-name name
:file file)))
@@ -343,7 +344,6 @@ be skipped."
(paced-load-dictionary-from-file dict-file))))
(cl-defmethod eieio-done-customizing ((dict paced-dictionary))
- ;; TODO validate options
(paced-register-dictionary (paced-dictionary-name dict) dict)
(paced--ensure-dictionary-directory)
(paced-save-dictionary dict))
diff --git a/test.mk b/test.mk
index 34de4f6..34a964c 100644
--- a/test.mk
+++ b/test.mk
@@ -20,8 +20,8 @@ test:
@$(EMACS) \
$(EMACSFLAGS) \
-L "." \
- --load "ert" \
- --load "paced-tests.el" \
+ -l "ert" \
+ -l "paced-tests.el" \
-f ert-run-tests-batch-and-exit
include Makefile
- [elpa] master 4162bd4 22/62: Changed name of registered checker, (continued)
- [elpa] master 4162bd4 22/62: Changed name of registered checker, Ian Dunn, 2017/12/09
- [elpa] master 302d4b4 28/62: Added convenience method for adding population commands, Ian Dunn, 2017/12/09
- [elpa] master 4824306 21/62: Make the registered dictionary map a hash table, Ian Dunn, 2017/12/09
- [elpa] master e751e4f 24/62: Update case-handling slot name in Documentation, Ian Dunn, 2017/12/09
- [elpa] master dada473 19/62: Push of info page, Ian Dunn, 2017/12/09
- [elpa] master 6e7d6d7 29/62: Updated method names in paced-repopulate-dictionary-async, Ian Dunn, 2017/12/09
- [elpa] master ce7a2be 20/62: Changed case-sensitivity to case-handling, Ian Dunn, 2017/12/09
- [elpa] master 35ba53b 26/62: Autoload paced-repopulate-named-dictionary-async, Ian Dunn, 2017/12/09
- [elpa] master 6e8acdf 09/62: Added documentation, Ian Dunn, 2017/12/09
- [elpa] master 0d17d8d 25/62: Warn before resetting dictionary during population, Ian Dunn, 2017/12/09
- [elpa] master 6aefb0b 05/62: Made dictionary names strings,
Ian Dunn <=
- [elpa] master bda0995 36/62: Remove inaccurate comment about completion in case-handling slot, Ian Dunn, 2017/12/09
- [elpa] master 7c9a342 39/62: Fixed paced-global-dict-enable-alist value type, Ian Dunn, 2017/12/09
- [elpa] master 8f1860a 37/62: Documentation fixes, Ian Dunn, 2017/12/09
- [elpa] master b95b016 38/62: Pushed updated info pages, Ian Dunn, 2017/12/09
- [elpa] master 964eb48 42/62: Fixed bug in completion, Ian Dunn, 2017/12/09
- [elpa] master 23c4a65 48/62: Mention common variables in population commands settings, Ian Dunn, 2017/12/09
- [elpa] master e293378 50/62: Fix completion falling back to other backend, Ian Dunn, 2017/12/09
- [elpa] master 3cd1147 45/62: Add IDs and descriptions for Contributing section, Ian Dunn, 2017/12/09
- [elpa] master 158ff71 56/62: Fixed internal links in documentation, Ian Dunn, 2017/12/09
- [elpa] master e611e61 33/62: Changed Emacs requirement to 25.1, Ian Dunn, 2017/12/09