]> code.delx.au - gnu-emacs-elpa/commitdiff
Cover load errors in auto-loaded back-ends.
authorNikolaj Schumacher <git@nschum.de>
Thu, 16 Apr 2009 15:21:48 +0000 (17:21 +0200)
committerNikolaj Schumacher <git@nschum.de>
Sat, 18 Apr 2009 09:47:06 +0000 (11:47 +0200)
Previously, it was enough to ignore errors when requiring.  Since back-ends
are now interactive and can be auto-loaded, the loading error could occur at
any time.

company.el

index a5eda31b14379eeef236c7369fd317195dbc987a..adb0d46116838748063a0906c1a03c9172f79915 100644 (file)
@@ -438,7 +438,9 @@ The work-around consists of adding a newline.")
   (when (symbolp backend)
     (unless (fboundp backend)
       (ignore-errors (require backend nil t)))
-    (unless (fboundp backend)
+    (if (and (fboundp backend)
+             (ignore-errors (funcall backend 'init) t))
+        (put backend 'company-init t)
       (message "Company back-end '%s' could not be initialized"
                backend))))
 
@@ -792,7 +794,8 @@ keymap during active completions (`company-active-map'):
                            ;; prefer manual override
                            (list company-backend)
                          company-backends))
-        (when (and (functionp backend)
+        (when (and (get backend 'company-init)
+                   (functionp backend)
                    (setq prefix (funcall backend 'prefix)))
           (when (and (stringp prefix)
                      (>= (length prefix) company-minimum-prefix-length))