]> code.delx.au - gnu-emacs-elpa/commitdiff
Added Windows root dir compatibility fixes.
authorNikolaj Schumacher <git@nschum.de>
Mon, 20 Apr 2009 12:00:56 +0000 (14:00 +0200)
committerNikolaj Schumacher <git@nschum.de>
Wed, 22 Apr 2009 16:19:17 +0000 (18:19 +0200)
company-eclim.el
company-etags.el
company-xcode.el
company.el

index a3c32a6d500c6e54d52c6cba307eb2d9c9e04763..4b8a5c94c61534a828c3bffc12eaeaf0ce062f34 100644 (file)
@@ -74,23 +74,11 @@ eclim can only complete correctly when the buffer has been saved."
   (mapcar (lambda (line) (nreverse (split-string line " *- *" nil)))
           (company-eclim--call-process "project_list")))
 
-(defun company-eclim--locate-dominating-file (file name)
-  (catch 'root
-    (let ((dir (file-name-directory buffer-file-name)))
-      (while (not (equal dir "/"))
-        (when (file-exists-p (expand-file-name name dir))
-          (throw 'root dir))
-        (setq dir (file-name-directory (directory-file-name dir)))))))
-
 (defun company-eclim--project-dir ()
   (if (eq company-eclim--project-dir 'unknown)
       (setq company-eclim--project-dir
             (directory-file-name
-             (if (fboundp 'locate-dominating-file)
-                 (expand-file-name (locate-dominating-file buffer-file-name
-                                                           ".project"))
-               (company-eclim--locate-dominating-file buffer-file-name
-                                                     ".project"))))
+             (company-locate-dominating-file buffer-file-name ".project")))
     company-eclim--project-dir))
 
 (defun company-eclim--project-name ()
index ac9da5701bc36e48edcbb424b774c57781d8c465..a5080cdea8568faf6102282bd0681e7cec91948a 100644 (file)
@@ -36,16 +36,11 @@ buffer automatically."
 (make-variable-buffer-local 'company-etags-buffer-table)
 
 (defun company-etags-find-table ()
-  (let ((dir (if buffer-file-name
-                 (file-name-directory buffer-file-name)
-               (expand-file-name default-directory)))
-        file)
-    (while (not (or file (equal dir "/")))
-      (unless (file-exists-p (setq file (expand-file-name "TAGS" dir)))
-        (setq file nil
-              dir (file-name-directory (directory-file-name dir)))))
+  (let ((file (company-locate-dominating-file (or buffer-file-name
+                                                  default-directory)
+                                              "TAGS")))
     (when file
-      (list file))))
+      (list (expand-file-name file)))))
 
 (defun company-etags-buffer-table ()
   (or (and company-etags-use-main-table-list tags-table-list)
index e2e3be320e0081dbc978c87cab5e9291e98fed50..df76a5782ab9ac93b63510c29fec125d136810f5 100644 (file)
@@ -79,9 +79,11 @@ valid in most contexts."
   (let ((dir (if buffer-file-name
                  (file-name-directory buffer-file-name)
                (expand-file-name default-directory)))
+        (prev-dir nil)
         file)
-    (while (not (or file (equal dir "/")))
+    (while (not (or file (equal dir prev-dir)))
       (setq file (car (directory-files dir t ".xcodeproj\\'" t))
+            prev-dir dir
             dir (file-name-directory (directory-file-name dir))))
     file))
 
index 8ea67116850eb0d0788698242122c54250feea38..d3caee658486db3773ad76dd6d1ddd748c7348aa 100644 (file)
@@ -69,6 +69,8 @@
 ;;
 ;;; Change Log:
 ;;
+;;    Windows compatibility fixes.
+;;
 ;; 2009-04-19 (0.4.1)
 ;;    Added `global-company-mode'.
 ;;    Performance enhancements.
@@ -633,6 +635,18 @@ keymap during active completions (`company-active-map'):
         (car (setq ppss (cdr ppss)))
         (nth 3 ppss))))
 
+(if (fboundp 'locate-dominating-file)
+    (defalias 'company-locate-dominating-file 'locate-dominating-file)
+  (defun company-locate-dominating-file (file name)
+    (catch 'root
+      (let ((dir (file-name-directory file))
+            (prev-dir nil))
+        (while (not (equal dir prev-dir))
+          (when (file-exists-p (expand-file-name name dir))
+            (throw 'root dir))
+          (setq prev-dir dir
+                dir (file-name-directory (directory-file-name dir))))))))
+
 (defun company-call-backend (&rest args)
   (if (functionp company-backend)
       (apply company-backend args)