company-eclim--project-dir: Try to handle non-project buffers
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 19 Jun 2016 23:46:51 +0000 (02:46 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 19 Jun 2016 23:46:51 +0000 (02:46 +0300)
Closes #532

company-eclim.el

index 208daf5..b37f756 100644 (file)
@@ -89,10 +89,11 @@ eclim can only complete correctly when the buffer has been saved."
 
 (defun company-eclim--project-dir ()
   (if (eq company-eclim--project-dir 'unknown)
-      (setq company-eclim--project-dir
-            (directory-file-name
-             (expand-file-name
-              (locate-dominating-file buffer-file-name ".project"))))
+      (let ((dir (locate-dominating-file buffer-file-name ".project")))
+        (when dir
+          (setq company-eclim--project-dir
+                (directory-file-name
+                 (expand-file-name dir)))))
     company-eclim--project-dir))
 
 (defun company-eclim--project-name ()