summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2023-04-06 18:35:26 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2023-04-06 18:35:26 +0200
commita81e27de546eb76c5a19be6b03fab8357bb5457e (patch)
tree42e713510c7b81d65ec730a528e645aa9a92e4ab
parent36256bb15c342ed89a141b77fdf0bf18e0cfb86b (diff)
cape-dict-file: Support multiple dictionaries
-rw-r--r--CHANGELOG.org1
-rw-r--r--cape.el10
2 files changed, 7 insertions, 4 deletions
diff --git a/CHANGELOG.org b/CHANGELOG.org
index c894a73..4d4918c 100644
--- a/CHANGELOG.org
+++ b/CHANGELOG.org
@@ -9,6 +9,7 @@
should return nil if the input must be considered invalid such that the
candidates must be recomputed.
- =cape-ispell=: Deprecate in favor of =cape-dict=.
+- =cape-dict-file=: Support multiple dictionary files.
* Version 0.13 (2023-02-15)
diff --git a/cape.el b/cape.el
index f6d4e67..46f3a33 100644
--- a/cape.el
+++ b/cape.el
@@ -63,8 +63,8 @@
:prefix "cape-")
(defcustom cape-dict-file "/usr/share/dict/words"
- "Dictionary word list file."
- :type 'string)
+ "Dictionary word list file or list of files."
+ :type '(choice string (repeat string)))
(defcustom cape-dict-grep t
"Use grep to search through `cape-dict-file'.
@@ -409,7 +409,8 @@ See the user options `cape-dabbrev-min-length' and
(defun cape--dict-grep-words (str)
"Return all words from `cape-dict-file' matching STR."
(unless (equal str "")
- (process-lines-ignore-status "grep" "-Fi" str cape-dict-file)))
+ (apply #'process-lines-ignore-status
+ "grep" "-Fi" str (ensure-list cape-dict-file))))
(defvar cape--dict-all-words nil)
(defun cape--dict-all-words ()
@@ -417,7 +418,8 @@ See the user options `cape-dabbrev-min-length' and
(or cape--dict-all-words
(setq cape--dict-all-words
(split-string (with-temp-buffer
- (insert-file-contents cape-dict-file)
+ (mapc #'insert-file-contents
+ (ensure-list cape-dict-file))
(buffer-string))
"\n" 'omit-nulls))))