(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 ()
(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)
(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))
;;
;;; Change Log:
;;
+;; Windows compatibility fixes.
+;;
;; 2009-04-19 (0.4.1)
;; Added `global-company-mode'.
;; Performance enhancements.
(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)