]> code.delx.au - gnu-emacs-elpa/commitdiff
company-clang: Only initialize in supported major modes
authorDmitry Gutov <dgutov@yandex.ru>
Wed, 20 Mar 2013 21:20:38 +0000 (01:20 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Wed, 20 Mar 2013 21:20:51 +0000 (01:20 +0400)
NEWS.md
company-clang.el

diff --git a/NEWS.md b/NEWS.md
index 1e562ff313e219a91e417cbaaabb0f9c0d525866..a14f6058f7b9ae056f74b559ea87bf6e80367039 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -2,6 +2,8 @@
 
 ## Next
 
+* `company-clang` is now only initialized in supported buffers.
+  So, no error messages if you don't have Clang until you open a C file.
 * `company-clang` recognizes Clang included with recent Xcode.
 * New commands `company-select-previous-or-abort` and
   `company-select-next-or-abort`, bound to `<up>` and `<down>`.
index 7c3a3b47fb4b6110d1bb4bc5508bfc416938cbbc..6b80ef02f77fb4b324a2ef50deeea11017392a07 100644 (file)
@@ -222,10 +222,11 @@ Completions only work correctly when the buffer has been saved.
   (interactive (list 'interactive))
   (case command
     (interactive (company-begin-backend 'company-clang))
-    (init (unless company-clang-executable
-            (error "Company found no clang executable"))
-          (when (< (company-clang-version) company-clang-required-version)
-            (error "Company requires clang version 1.1")))
+    (init (when (memq major-mode company-clang-modes)
+            (unless company-clang-executable
+              (error "Company found no clang executable"))
+            (when (< (company-clang-version) company-clang-required-version)
+              (error "Company requires clang version 1.1"))))
     (prefix (and (memq major-mode company-clang-modes)
                  buffer-file-name
                  company-clang-executable