]> code.delx.au - gnu-emacs-elpa/commitdiff
Deal with missing ispell look command.
authorNikolaj Schumacher <git@nschum.de>
Thu, 19 Mar 2009 20:37:13 +0000 (21:37 +0100)
committerNikolaj Schumacher <git@nschum.de>
Fri, 20 Mar 2009 11:58:30 +0000 (12:58 +0100)
company-ispell.el

index b5b1a616f03e7412459d031182d16b69242874c2..14bdba395bfded16a22e65680f0779497dd33b99 100644 (file)
@@ -28,9 +28,23 @@ If nil, use `ispell-complete-word-dict'."
   :type '(choice (const :tag "default (nil)" nil)
                  (file :tag "dictionary" t)))
 
+(defvar company-ispell-available 'unknown)
+
+(defun company-ispell-available ()
+  (when (eq company-ispell-available 'unknown)
+    (condition-case err
+        (progn
+          (lookup-words "WHATEVER")
+          (setq company-ispell-available t))
+      (error
+       (message "Company: ispell-look-command not found")
+       (setq company-ispell-available nil))))
+  company-ispell-available)
+
 (defun company-ispell (command &optional arg &rest ignored)
   (case command
-    ('prefix (company-grab "\\<\\w+\\>"))
+    ('prefix (when (company-ispell-available)
+               (company-grab "\\<\\w+\\>")))
     ('candidates (lookup-words arg (or company-ispell-dictionary
                                        ispell-complete-word-dict)))
     ('sorted t)