[Top][All Lists]

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

[elpa] master 79c22c2 06/62: Added new customization options for paced-l

From: Ian Dunn
Subject: [elpa] master 79c22c2 06/62: Added new customization options for paced-load-all-dictionaries
Date: Sat, 9 Dec 2017 14:33:56 -0500 (EST)

branch: master
commit 79c22c2666255840082b9bfc7a0a5d5dbeed23dd
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>

    Added new customization options for paced-load-all-dictionaries
    * paced.el (paced-dictionary-directory-whitelist-regexp):
      (paced-load-all-dictionaries-recursively): New defcustoms.
      (paced-load-all-dictionaries): Implement them.
 paced.el | 34 +++++++++++++++++++++++++++++++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff --git a/paced.el b/paced.el
index 963441a..0a59842 100644
--- a/paced.el
+++ b/paced.el
@@ -82,6 +82,27 @@ the user whether to save dictionaries here."
   :group 'paced
   :type 'directory)
+(defcustom paced-dictionary-directory-whitelist-regexp ".*"
+  "Regexp to match when reading from the dictionary directory.
+Any files that match this regexp will be loaded by
+  :group 'paced
+  :type 'regexp)
+(defcustom paced-dictionary-directory-blacklist-regexp "$^"
+  "Regexp to match for files NOT to load with `paced-load-all-dictionaries'.
+This is the string \"$^\" by default, which matches nothing, thus
+allowing all files."
+  :group 'paced
+  :type 'regexp)
+(defcustom paced-load-all-dictionaries-recursively nil
+  "Whether to recursively load all files with `paced-load-all-dictionaries'."
+  :group 'paced
+  :type 'boolean)
 (defcustom paced-repopulate-saves-dictionary t
   "Whether to save a dictionary after repopulation."
   :group 'paced
@@ -339,9 +360,16 @@ be skipped."
   (message "Loading all dictionaries from %s" paced-dictionary-directory)
-  (dolist (dict-file (directory-files paced-dictionary-directory t))
-    (when (file-regular-p dict-file)
-      (paced-load-dictionary-from-file dict-file))))
+  (let ((files-to-load
+         (if paced-load-all-dictionaries-recursively
+             (directory-files-recursively paced-dictionary-directory
+           (directory-files paced-dictionary-directory t
+                            paced-dictionary-directory-whitelist-regexp))))
+    (dolist (dict-file files-to-load)
+      (when (and (file-regular-p dict-file)
+                 (not (string-match-p 
paced-dictionary-directory-blacklist-regexp dict-file)))
+        (paced-load-dictionary-from-file dict-file)))))
 (cl-defmethod eieio-done-customizing ((dict paced-dictionary))
   (paced-register-dictionary (paced-dictionary-name dict) dict)

reply via email to

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