X-Git-Url: https://code.delx.au/gnu-emacs-elpa/blobdiff_plain/bd82c7e096ecf4c6f0a0545f442be4296c741db5..a95d7f1d6a25c11496f0606eb868343505db921b:/company-ispell.el diff --git a/company-ispell.el b/company-ispell.el index 3e599f03e..91f43df9b 100644 --- a/company-ispell.el +++ b/company-ispell.el @@ -1,6 +1,6 @@ -;;; company-ispell.el --- company-mode completion back-end using Ispell +;;; company-ispell.el --- company-mode completion backend using Ispell -;; Copyright (C) 2009-2011 Free Software Foundation, Inc. +;; Copyright (C) 2009-2011, 2013-2015 Free Software Foundation, Inc. ;; Author: Nikolaj Schumacher @@ -26,11 +26,11 @@ ;;; Code: (require 'company) +(require 'cl-lib) (require 'ispell) -(eval-when-compile (require 'cl)) (defgroup company-ispell nil - "Completion back-end using Ispell." + "Completion backend using Ispell." :group 'company) (defcustom company-ispell-dictionary nil @@ -54,14 +54,21 @@ If nil, use `ispell-complete-word-dict'." ;;;###autoload (defun company-ispell (command &optional arg &rest ignored) - "`company-mode' completion back-end using Ispell." + "`company-mode' completion backend using Ispell." (interactive (list 'interactive)) - (case command + (cl-case command (interactive (company-begin-backend 'company-ispell)) (prefix (when (company-ispell-available) (company-grab-word))) - (candidates (lookup-words arg (or company-ispell-dictionary - ispell-complete-word-dict))) + (candidates + (let ((words (lookup-words arg (or company-ispell-dictionary + ispell-complete-word-dict))) + (completion-ignore-case t)) + (if (string= arg "") + ;; Small optimization. + words + ;; Work around issue #284. + (all-completions arg words)))) (sorted t) (ignore-case 'keep-prefix)))