[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 4824306 21/62: Make the registered dictionary map a hash t

From: Ian Dunn
Subject: [elpa] master 4824306 21/62: Make the registered dictionary map a hash table
Date: Sat, 9 Dec 2017 14:33:59 -0500 (EST)

branch: master
commit 482430643846adc052770e120ec1f6fb623b4459
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>

    Make the registered dictionary map a hash table
    * paced.el (paced--registered-dictionaries): Change default.
      (paced-dictionary-register): Remove additional argument.
 paced.el | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/paced.el b/paced.el
index 51f885e..728d0b6 100644
--- a/paced.el
+++ b/paced.el
@@ -198,14 +198,14 @@ and return a sorted hash-table.
 This defaults to `paced--default-dictionary-sort-func'."))
   "Paced dictionary.")
-(defvar paced--registered-dictionaries nil
+(defvar paced--registered-dictionaries (make-hash-table :test 'equal)
   "Internal list of registered dictionaries.
 Do not edit this list manually.  Use `paced-make-dictionary'
 (defsubst paced-named-dictionary (key)
-  (map-elt paced--registered-dictionaries key nil 'equal))
+  (map-elt paced--registered-dictionaries key nil))
 (defsubst paced-dictionary-names ()
   (map-keys paced--registered-dictionaries))
@@ -214,14 +214,14 @@ instead.")
   (completing-read "Dictionary: " (map-keys paced--registered-dictionaries)))
 (defsubst paced-dictionary-registered-p (key)
-  (map-contains-key paced--registered-dictionaries key 'equal))
+  (map-contains-key paced--registered-dictionaries key))
 (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 'equal))
+(cl-defmethod paced-dictionary-register ((dict paced-dictionary))
+  (map-put paced--registered-dictionaries (oref dict object-name) dict))
 (defsubst paced--ensure-dictionary-directory ()
   (make-directory paced-dictionary-directory t))
@@ -239,7 +239,7 @@ Return value is the new dictionary."
                    :object-name name
                    :file filename
                    :case-handling case-handling)))
-    (paced-register-dictionary name new-dict)
+    (paced-dictionary-register new-dict)
 (defun paced-create-new-dictionary (name file)
@@ -298,6 +298,10 @@ Has the same form as and takes priority over
 (defun paced-dict-enable-list ()
+  "Return the combination of the local and global enable-alists.
+See `paced-local-dict-enable-alist' and
+`paced-global-dict-enable-alist' for more information."
   (append paced-local-dict-enable-alist

reply via email to

[Prev in Thread] Current Thread [Next in Thread]