emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] master 82bd0da 23/62: Fixed various defmethod names to use paced-


From: Ian Dunn
Subject: [elpa] master 82bd0da 23/62: Fixed various defmethod names to use paced-dictionary- prefix
Date: Sat, 9 Dec 2017 14:33:59 -0500 (EST)

branch: master
commit 82bd0da59310b71b832ba32e9baf6d154ed5c742
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>

    Fixed various defmethod names to use paced-dictionary- prefix
    
    * paced.el (paced-reset-registered-dictionaries): New function.
      (paced-dictionary-save): Renamed from paced-save-dictionary.
      (paced-dictionary-reset): Renamed from "paced-reset-dictionary".
      (paced-dictionary-sort): Renamed from "paced-sort-dictionary".
      (paced-dictionary-add-word): Renamed and made method from
      "paced-add-word-to-dict".
      (paced-dictionary-populate-from-buffer): Renamed from
      "paced-populate-dictionary-from-buffer".
      (paced-dictionary-repopulate): Renamed from "paced-repopulate-dictionary"
      (paced-dictionary-edit): New defmethod
      (paced-save-named-dictionary):
      (paced-save-all-dictionaries):
      (paced-load-dictionary-from-file):
      (eieio-done-customizing):
      (paced-add-word-to-current-dict):
      (paced-populate-dictionary-from-region):
      (paced-populate-buffer-dictionary):
      (paced-populate-from-region):
      (paced-reset-named-dictionary):
      (paced-sort-named-dictionary):
      (paced-repopulate-named-dictionary):
      (paced-add-buffer-file-to-dictionary):
      (paced-edit-named-dictionary):
      (paced-edit-current-dictionary): Use new names.
    
    * paced-tests.el: Update tests.
---
 paced-tests.el | 65 +++++++++++++++++++++++-----------------------
 paced.el       | 82 ++++++++++++++++++++++++++++++++--------------------------
 2 files changed, 79 insertions(+), 68 deletions(-)

diff --git a/paced-tests.el b/paced-tests.el
index 2aa53d5..b4a2c41 100644
--- a/paced-tests.el
+++ b/paced-tests.el
@@ -37,6 +37,7 @@
 (defconst paced-third-test-file (paced-test-file "third.org"))
 
 (defconst paced-test-dict-save-file (paced-test-file 
"paced-dictionary-case-sensitive"))
+(defconst paced-test-default-registered-map (make-hash-table :test 'equal))
 
 (ert-deftest paced-handle-word-case ()
   (let* ((word "EiEiO"))
@@ -47,17 +48,17 @@
     (should (string-equal (paced--handle-word-case 'upcase-first word) 
"EiEiO"))))
 
 (ert-deftest paced-create-dictionary ()
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (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"
                                           paced-test-dict-save-file
                                           'downcase)))
-    (should (= (length paced--registered-dictionaries) 1))
+    (should (= (map-length paced--registered-dictionaries) 1))
     (should (paced-dictionary-p new-dict))
     (oset new-dict updated t) ;; Mark it as updated so it saves
-    (paced-save-dictionary new-dict)
+    (paced-dictionary-save new-dict)
     (should (file-exists-p paced-test-dict-save-file))
     ;; Either it didn't exist before, or the old mod time is before the new mod
     ;; time.  In other words, it updated.
@@ -66,17 +67,17 @@
                              (file-attribute-modification-time 
(file-attributes paced-test-dict-save-file)))))))
 
 (ert-deftest paced-load-dictionary ()
-  (let* ((paced--registered-dictionaries nil))
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map))
     (paced-load-dictionary-from-file paced-test-dict-save-file)
-    (should (= (length paced--registered-dictionaries) 1))
+    (should (= (map-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" nil 'string-equal)))))
+    (should (paced-dictionary-p (map-elt paced--registered-dictionaries 
"test-dict-case" nil)))))
 
 (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)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (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)
@@ -90,7 +91,7 @@
 
 (ert-deftest paced-enable-list-mode ()
   "Test case for `paced-dictionary-enable-alist' being a mode symbol."
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (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)))
@@ -108,7 +109,7 @@
 
 (ert-deftest paced-enable-list-function-symbol ()
   "Test case for `paced-dictionary-enable-alist' being a function symbol."
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (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)
@@ -122,7 +123,7 @@
 
 (ert-deftest paced-enable-list-lambda-function ()
   "Test case for `paced-dictionary-enable-alist' being a lambda form."
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (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)
@@ -136,7 +137,7 @@
 
 (ert-deftest paced-enable-list-and-form ()
   "Test case for `paced-dictionary-enable-alist' being an 'and' form."
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (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)))
@@ -157,7 +158,7 @@
 
 (ert-deftest paced-enable-list-or-form ()
   "Test case for `paced-dictionary-enable-alist' being an 'or' form."
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (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)))
@@ -180,7 +181,7 @@
 
 (ert-deftest paced-populate-file ()
   "Test case for single file populator."
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
          (cmd (paced-file-population-command :file paced-first-test-file))
          test-dict)
@@ -188,7 +189,7 @@
     (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)
+    (paced-dictionary-repopulate test-dict)
     (let ((usage-hash (oref test-dict usage-hash)))
       (should (eq (map-length usage-hash) 4))
       (should (seq-set-equal-p (map-keys usage-hash) '("one" "two" "three" 
"four")))
@@ -199,7 +200,7 @@
 
 (ert-deftest paced-populate-buffer ()
   "Test case for single buffer populator."
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
          (buffer "first.txt")
          (buffer-one (find-file-noselect paced-first-test-file))
@@ -209,7 +210,7 @@
     (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)
+    (paced-dictionary-repopulate test-dict)
     (let ((usage-hash (oref test-dict usage-hash)))
       (should (eq (map-length usage-hash) 4))
       (should (seq-set-equal-p (map-keys usage-hash) '("one" "two" "three" 
"four")))
@@ -221,7 +222,7 @@
 
 (ert-deftest paced-populate-file-function ()
   "Test case for file-function populator."
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (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
@@ -231,7 +232,7 @@
     (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)
+    (paced-dictionary-repopulate test-dict)
     (let ((usage-hash (oref test-dict usage-hash)))
       (should (eq (map-length usage-hash) 4))
       (should (seq-set-equal-p (map-keys usage-hash) '("one" "two" "three" 
"four")))
@@ -242,7 +243,7 @@
 
 (ert-deftest paced-populate-directory-regexp ()
   "Test case for directory-regexp populator."
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
          (cmd (paced-directory-regexp-population-command :directory 
paced-test-dir
                                                          :regexp ".*\\.txt"
@@ -252,7 +253,7 @@
     (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)
+    (paced-dictionary-repopulate test-dict)
     (let ((usage-hash (oref test-dict usage-hash)))
       (should (eq (map-length usage-hash) 4))
       (should (seq-set-equal-p (map-keys usage-hash) '("one" "two" "three" 
"four")))
@@ -263,7 +264,7 @@
 
 (ert-deftest paced-populate-file-list ()
   "Test case for file-list populator."
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (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))
@@ -272,7 +273,7 @@
     (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)
+    (paced-dictionary-repopulate test-dict)
     (let ((usage-hash (oref test-dict usage-hash)))
       (should (eq (map-length usage-hash) 4))
       (should (seq-set-equal-p (map-keys usage-hash) '("one" "two" "three" 
"four")))
@@ -282,7 +283,7 @@
       (should (eq (map-elt usage-hash "four") 4)))))
 
 (ert-deftest paced-multiple-population-commands ()
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (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))
@@ -291,7 +292,7 @@
     (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)
+    (paced-dictionary-repopulate test-dict)
     (let ((usage-hash (oref test-dict usage-hash)))
       (should (eq (map-length usage-hash) 7))
       (should (seq-set-equal-p (map-keys usage-hash) '("one" "two" "three" 
"four" "five" "six" "seven")))
@@ -304,7 +305,7 @@
       (should (eq (map-elt usage-hash "seven") 1)))))
 
 (ert-deftest paced-populator-settings ()
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (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))
@@ -315,7 +316,7 @@
     (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)
+    (paced-dictionary-repopulate test-dict)
     (let ((usage-hash (oref test-dict usage-hash)))
       (should (eq (map-length usage-hash) 4))
       (should (seq-set-equal-p (map-keys usage-hash) '("one" "two" "three" 
"four")))
@@ -326,7 +327,7 @@
 
 (ert-deftest paced-populate-sort-order ()
   "Test case for sorting after population."
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (paced-global-dict-enable-alist '((text-mode . "test-dict-case")))
          (cmd (paced-file-population-command :file paced-first-test-file))
          test-dict)
@@ -334,7 +335,7 @@
     (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)
+    (paced-dictionary-repopulate test-dict)
     (let ((usage-hash (oref test-dict usage-hash)))
       (should (eq (map-length usage-hash) 4))
       (should (equal (map-keys usage-hash) '("four" "three" "two" "one")))
@@ -344,7 +345,7 @@
       (should (eq (map-elt usage-hash "four") 4)))))
 
 (ert-deftest paced-populate-non-existent-file ()
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (file "first.txt")
          (cmd (paced-file-population-command :file file))
          test-dict)
@@ -352,12 +353,12 @@
     (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)
+    (paced-dictionary-repopulate test-dict)
     (let ((usage-hash (oref test-dict usage-hash)))
       (should (map-empty-p usage-hash)))))
 
 (ert-deftest paced-populate-non-existent-buffer ()
-  (let* ((paced--registered-dictionaries nil)
+  (let* ((paced--registered-dictionaries paced-test-default-registered-map)
          (buffer "first.txt")
          (cmd (paced-buffer-population-command :buffer buffer))
          test-dict)
@@ -365,7 +366,7 @@
     (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)
+    (paced-dictionary-repopulate test-dict)
     (let ((usage-hash (oref test-dict usage-hash)))
       (should (map-empty-p usage-hash)))))
 
diff --git a/paced.el b/paced.el
index 243b61c..1d4a2e6 100644
--- a/paced.el
+++ b/paced.el
@@ -204,6 +204,17 @@ This defaults to `paced--default-dictionary-sort-func'."))
 Do not edit this list manually.  Use `paced-make-dictionary'
 instead.")
 
+(defun paced-reset-registered-dictionaries ()
+  "Reset the registered dictionary list.
+
+WARNING: This will result in the loss of all dictionaries.  Only
+do this if you know what you're doing, or are under the
+supervision of someone who does."
+  (interactive)
+  (when (yes-or-no-p
+         "Warning: This will result in loss of all dictionaries.  Continue?")
+    (setq paced--registered-dictionaries (make-hash-table :test 'equal))))
+
 (defsubst paced-named-dictionary (key)
   (map-elt paced--registered-dictionaries key nil))
 
@@ -348,7 +359,7 @@ be skipped."
     (when dictionary
       (paced-named-dictionary dictionary))))
 
-(cl-defmethod paced-save-dictionary ((dict paced-dictionary))
+(cl-defmethod paced-dictionary-save ((dict paced-dictionary))
   "Save dictionary DICT according to its filename."
   (when (oref dict updated)
     (eieio-persistent-save dict))
@@ -356,27 +367,25 @@ be skipped."
 
 (defun paced-save-named-dictionary (key)
   "Save dictionary named KEY."
-  (declare (interactive-only paced-save-dictionary))
+  (declare (interactive-only paced-dictionary-save))
   (interactive (list (paced-read-dictionary)))
   (paced-ensure-registered key)
   (let ((dict (paced-named-dictionary key)))
-    (paced-save-dictionary dict)))
+    (paced-dictionary-save dict)))
 
 (defun paced-load-dictionary-from-file (file)
   "Load dictionary from FILE."
   (interactive
    (list (read-file-name "Dictionary File: " paced-dictionary-directory)))
   (when-let* ((new-dict (eieio-persistent-read file 'paced-dictionary)))
-    (paced-register-dictionary
-     (paced-dictionary-name new-dict)
-     new-dict)))
+    (paced-dictionary-register new-dict)))
 
 (defun paced-save-all-dictionaries ()
   "Save all registered dictionaries."
   (interactive)
   (map-apply
    (lambda (_ dict)
-     (paced-save-dictionary dict))
+     (paced-dictionary-save dict))
    paced--registered-dictionaries))
 
 ;;;###autoload
@@ -397,9 +406,9 @@ be skipped."
         (paced-load-dictionary-from-file dict-file)))))
 
 (cl-defmethod eieio-done-customizing ((dict paced-dictionary))
-  (paced-register-dictionary (paced-dictionary-name dict) dict)
+  (paced-dictionary-register dict)
   (paced--ensure-dictionary-directory)
-  (paced-save-dictionary dict))
+  (paced-dictionary-save dict))
 
 
 
@@ -466,11 +475,8 @@ This is a separate function only for testing; use
   "Return WORD, modified based on DICT's case handling."
   (paced--handle-word-case (oref dict case-handling) word))
 
-(defsubst paced-add-word-to-dict (dict word)
+(cl-defmethod paced-dictionary-add-word ((dict paced-dictionary) word)
   "Add WORD to paced dictionary DICT."
-  ;; If I've got a word uppercase and lowercase in my usage table, I'm
-  ;; going to have repeats when ignore case is enabled.  To solve this,
-  ;; downcase everything when not case sensitive.
   (let ((new-word (paced-dictionary-process-word dict word)))
     ;; Use the full name here to silence the byte-compiler
     (cl-incf (map-elt (oref dict usage-hash) new-word 0))
@@ -479,10 +485,10 @@ This is a separate function only for testing; use
 (defsubst paced-add-word-to-current-dict (word)
   "Add WORD to the current paced dictionary."
   (if-let* ((dict (paced-current-dictionary)))
-      (paced-add-word-to-dict dict word)
-    (error "No dictionary found")))
+      (paced-dictionary-add-word dict word)
+    (error "No current dictionary found.")))
 
-(cl-defmethod paced-populate-dictionary-from-buffer ((dict paced-dictionary) 
&optional buffer)
+(cl-defmethod paced-dictionary-populate-from-buffer ((dict paced-dictionary) 
&optional buffer)
   (with-current-buffer (or buffer (current-buffer))
     (save-excursion
       (goto-char (point-min))
@@ -497,7 +503,7 @@ This is a separate function only for testing; use
            reporter
            (floor (* 100.0 (/ (float (point)) (point-max)))))
           (unless (paced-excluded-p)
-            (paced-add-word-to-dict dict (paced-thing-at-point))))
+            (paced-dictionary-add-word dict (paced-thing-at-point))))
         (progress-reporter-done reporter)))))
 
 (defun paced-populate-dictionary-from-region (dict start end)
@@ -505,12 +511,12 @@ This is a separate function only for testing; use
 
 Note that this doesn't add the current buffer to DICT's
 population commands, so if DICT is later repopulated using
-`paced-repopulate-dictionary' or
+`paced-dictionary-repopulate' or
 `paced-repopulate-named-dictionary', anything added with this
 command will be lost."
   (save-restriction
     (narrow-to-region start end)
-    (paced-populate-dictionary-from-buffer dict)))
+    (paced-dictionary-populate-from-buffer dict)))
 
 (defun paced-populate-buffer-dictionary (&optional buffer)
   "Populate BUFFER's current dictionary with BUFFER.
@@ -523,7 +529,7 @@ only populate the dictionary from a region,
 
 Note that this doesn't add BUFFER to the dictionary's population
 commands, so if it is later repopulated using
-`paced-repopulate-dictionary' or
+`paced-dictionary-repopulate' or
 `paced-repopulate-named-dictionary', anything added with this
 command will be lost.
 
@@ -531,7 +537,7 @@ In order to make changes permanent, use
 `paced-add-buffer-file-to-dictionary'."
   (interactive)
   (if-let* ((dict (paced-current-dictionary)))
-      (paced-populate-dictionary-from-buffer dict buffer)
+      (paced-dictionary-populate-from-buffer dict buffer)
     (user-error "No dictionary found")))
 
 (defun paced-populate-from-region (start end)
@@ -539,7 +545,7 @@ In order to make changes permanent, use
 
 Note that this doesn't add the current buffer to the dictionary's
 population commands, so if it is later repopulated using
-`paced-repopulate-dictionary' or
+`paced-dictionary-repopulate' or
 `paced-repopulate-named-dictionary', anything added with this
 command will be lost."
   (interactive "r")
@@ -555,13 +561,13 @@ excluded.
 
 Note that this doesn't add anything to the dictionary's
 population commands, so if it is later repopulated using
-`paced-repopulate-dictionary' or
+`paced-dictionary-repopulate' or
 `paced-repopulate-named-dictionary', anything added with this
 command will be lost."
   (interactive)
   (paced-add-word-to-current-dict (paced-thing-at-point)))
 
-(cl-defmethod paced-reset-dictionary ((dict paced-dictionary))
+(cl-defmethod paced-dictionary-reset ((dict paced-dictionary))
   "Reset the usage-hash of paced-dictionary DICT."
   (oset dict usage-hash (oref-default dict usage-hash)))
 
@@ -571,9 +577,9 @@ command will be lost."
    (list (paced-read-dictionary)))
   (paced-ensure-registered key)
   (let ((dict (paced-named-dictionary key)))
-    (paced-reset-dictionary dict)))
+    (paced-dictionary-reset dict)))
 
-(cl-defmethod paced-sort-dictionary ((dict paced-dictionary))
+(cl-defmethod paced-dictionary-sort ((dict paced-dictionary))
   (oset dict usage-hash
         (funcall (oref dict sort-method)
                  (oref dict usage-hash))))
@@ -582,7 +588,7 @@ command will be lost."
   (interactive (list (paced-read-dictionary)))
   (paced-ensure-registered key)
   (let ((dict (paced-named-dictionary key)))
-    (paced-sort-dictionary dict)))
+    (paced-dictionary-sort dict)))
 
 
 
@@ -739,7 +745,7 @@ Return non-nil if setup was successful and population can 
continue.")
         ;; should be disabled.
         (let ((paced--current-source source))
           (when (paced-population-command-setup-buffer cmd source)
-            (eval (macroexp-let* props `(paced-populate-dictionary-from-buffer 
,dict)))))))))
+            (eval (macroexp-let* props `(paced-dictionary-populate-from-buffer 
,dict)))))))))
 
 (defclass paced-file-population-command (paced-population-command)
   ((file :initarg :file
@@ -858,7 +864,7 @@ match a regular expression.")
                                 (eieio-class-children 
'paced-population-command))))
     (funcall (intern type))))
 
-(cl-defmethod paced-repopulate-dictionary ((dict paced-dictionary))
+(cl-defmethod paced-dictionary-repopulate ((dict paced-dictionary))
   "Repopulate dictionary DICT from its population commands.
 
 Population commands are stored in the field of the same name.
@@ -866,12 +872,12 @@ Population commands are stored in the field of the same 
name.
 Note that this will empty the dictionary's contents before
 repopulating it."
   ;; Empty the dictionary
-  (paced-reset-dictionary dict)
+  (paced-dictionary-reset dict)
   (dolist (cmd (oref dict population-commands))
     (paced-population-command-populate-dictionary dict cmd))
-  (paced-sort-dictionary dict)
+  (paced-dictionary-sort dict)
   (when paced-repopulate-saves-dictionary
-    (paced-save-dictionary dict)))
+    (paced-dictionary-save dict)))
 
 (defun paced-repopulate-named-dictionary (key)
   "Repopulate dictionary named KEY from its population commands.
@@ -885,7 +891,7 @@ repopulating it."
   (paced-ensure-registered key)
   (let ((dict (paced-named-dictionary key)))
     ;; TODO: Warn about reset.
-    (paced-repopulate-dictionary dict)))
+    (paced-dictionary-repopulate dict)))
 
 (defun paced-add-buffer-file-to-dictionary (&optional buffer)
   "Populate the dictionary of BUFFER with BUFFER.
@@ -904,24 +910,28 @@ must be set with `paced-edit-named-dictionary' or
               (file-name (buffer-file-name))
               (cmd (paced-file-population-command :file file-name)))
         (progn
-          (paced-populate-dictionary-from-buffer dict buffer)
+          (paced-dictionary-populate-from-buffer dict buffer)
           (cl-pushnew cmd (oref dict population-commands) :test 'equal))
       (user-error "No dictionary found for current buffer."))))
 
 
 
+(cl-defmethod paced-dictionary-edit ((dict paced-dictionary))
+  "Edit paced-dictionary DICT."
+  (customize-object dict))
+
 (defun paced-edit-named-dictionary (name)
   "Edit the paced-dictionary named NAME."
   (interactive (list (paced-read-dictionary)))
   (if-let* ((dict (paced-named-dictionary name)))
-      (customize-object dict)
+      (paced-dictionary-edit dict)
     (error "No paced dictionary called '%s' has been registered." name)))
 
 (defun paced-edit-current-dictionary ()
   "Edit the current paced dictionary."
   (interactive)
   (if-let* ((dict (paced-current-dictionary)))
-      (customize-object dict)
+      (paced-dictionary-edit dict)
     (user-error "No dictionary found for current buffer")))
 
 



reply via email to

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