diff --git a/company-wordfreq.el b/company-wordfreq.el index 35714b0..6982215 100644 --- a/company-wordfreq.el +++ b/company-wordfreq.el @@ -158,12 +158,11 @@ introduce latency to the completion proposals." (defun company-wordfreq--proposal-list () "Get the friendly names of the languages." - (mapcar (lambda (elt) (car (cdr elt))) company-wordfreq--language-alist)) + (mapcar 'car company-wordfreq--language-alist)) (defun company-wordfreq--iso-code (language) "Get the iso code of LANGUAGE" - (car (seq-find (lambda (elt) (equal (car (cdr elt)) language)) - company-wordfreq--language-alist))) + (cdr (assoc language company-wordfreq--language-alist))) (defconst company-wordfreq--frequency-word-url-prefix "https://raw.githubusercontent.com/johannes-mueller/FrequencyWords/master/content/2018/") @@ -222,64 +221,64 @@ Consider filing an issue")) (setq company-wordfreq--word-list-buffer nil))) (defconst company-wordfreq--language-alist - '(("af" "afrikaans") - ("ar" "arabic") - ("bg" "bulgarian") - ("bn" "bengali") - ("br" "breton") - ("bs" "bosnian") - ("ca" "catalan") - ("cs" "czech") - ("da" "danish") - ("de" "german") - ("el" "greek") - ("en" "english") - ("eo" "esperanto") - ("es" "spanish") - ("et" "estonian") - ("eu" "basque") - ("fa" "persian") - ("fi" "finnish") - ("fr" "french") - ("gl" "galician") - ("he" "hebrew") - ("hi" "hindi") - ("hr" "croatian") - ("hu" "hungarian") - ("hy" "armenian") - ("id" "indonesian") - ("is" "icelandic") - ("it" "italian") - ("ja" "japanese") - ("ka" "georgian") - ("kk" "kazakh") - ("ko" "korean") - ("lt" "lithuanian") - ("lv" "latvian") - ("mk" "macedonian") - ("ml" "malayalam") - ("ms" "malay") - ("nl" "dutch") - ("no" "norwegian") - ("pl" "polish") - ("pt" "portuguese") - ("pt_br" "brasileiro") - ("ro" "romanian") - ("ru" "russian") - ("si" "sinhala") - ("sk" "slovak") - ("sl" "slovenian") - ("sq" "albanian") - ("sr" "serbian") - ("sv" "swedish") - ("ta" "tamil") - ("te" "telugu") - ("th" "thai") - ("tl" "tagalog") - ("tr" "turkish") - ("uk" "ukrainian") - ("ur" "urdu") - ("vi" "vietnamese"))) + '(("afrikaans" . "af") + ("arabic" . "ar") + ("bulgarian" . "bg") + ("bengali" . "bn") + ("breton" . "br") + ("bosnian" . "bs") + ("catalan" . "ca") + ("czech" . "cs") + ("danish" . "da") + ("german" . "de") + ("greek" . "el") + ("english" . "en") + ("esperanto" . "eo") + ("spanish" . "es") + ("estonian" . "et") + ("basque" . "eu") + ("persian" . "fa") + ("finnish" . "fi") + ("french" . "fr") + ("galician" . "gl") + ("hebrew" . "he") + ("hindi" . "hi") + ("croatian" . "hr") + ("hungarian" . "hu") + ("armenian" . "hy") + ("indonesian" . "id") + ("icelandic" . "is") + ("italian" . "it") + ("japanese" . "ja") + ("georgian" . "ka") + ("kazakh" . "kk") + ("korean" . "ko") + ("lithuanian" . "lt") + ("latvian" . "lv") + ("macedonian" . "mk") + ("malayalam" . "ml") + ("malay" . "ms") + ("dutch" . "nl") + ("norwegian" . "no") + ("polish" . "pl") + ("portuguese" . "pt") + ("brasileiro" . "pt_br") + ("romanian" . "ro") + ("russian" . "ru") + ("sinhala" . "si") + ("slovak" . "sk") + ("slovenian" . "sl") + ("albanian" . "sq") + ("serbian" . "sr") + ("swedish" . "sv") + ("tamil" . "ta") + ("telugu" . "te") + ("thai" . "th") + ("tagalog" . "tl") + ("turkish" . "tr") + ("ukrainian" . "uk") + ("urdu" . "ur") + ("vietnamese" . "vi"))) (provide 'company-wordfreq) ;;; company-wordfreq.el ends here diff --git a/test/company-wordfreq.el-test.el b/test/company-wordfreq.el-test.el index d556c3b..4829e9b 100644 --- a/test/company-wordfreq.el-test.el +++ b/test/company-wordfreq.el-test.el @@ -103,13 +103,13 @@ (should (equal (company-wordfreq--default-path) "/home/user/.emacs.d/wordfreq-dicts")))) (ert-deftest test-language-proposal-list () - (let ((company-wordfreq--language-alist '(("eo" "esperanto") - ("en" "english")))) + (let ((company-wordfreq--language-alist '(("esperanto" . "eo") + ("english" . "en")))) (should (equal (company-wordfreq--proposal-list) '("esperanto" "english"))))) (ert-deftest test-language-iso-code-list () - (let ((company-wordfreq--language-alist '(("eo" "esperanto") - ("en" "english")))) + (let ((company-wordfreq--language-alist '(("esperanto" . "eo") + ("english" . "en")))) (should (equal (company-wordfreq--iso-code "esperanto") "eo")))) (ert-deftest test-make-url-full ()