;;; company-eclim.el --- a company-mode completion back-end for eclim.
;;
-;; Copyright (C) 2009 Nikolaj Schumacher
+;; Copyright (C) 2009-2010 Nikolaj Schumacher
;;
-;; This file is part of company 0.4.2.
+;; This file is part of company 0.4.3.
;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
:group 'company
:type 'file)
-(defcustom company-eclim-auto-save nil
+(defcustom company-eclim-auto-save t
"*Determines whether to save the buffer when retrieving completions.
eclim can only complete correctly when the buffer has been saved."
:group 'company
lines))
(defun company-eclim--call-process (&rest args)
- (let ((coding-system-for-read 'utf-8))
+ (let ((coding-system-for-read 'utf-8)
+ res)
(with-temp-buffer
- (if (= 0 (apply 'call-process company-eclim-executable nil t nil
- "-command" args))
+ (if (= 0 (setq res (apply 'call-process company-eclim-executable nil t nil
+ "-command" args)))
(company-eclim--buffer-lines)
- (message "Company-eclim command failed")
+ (message "Company-eclim command failed with error %d:\n%s" res
+ (buffer-substring (point-min) (point-max)))
nil))))
(defun company-eclim--project-list ()
(if (eq company-eclim--project-dir 'unknown)
(setq company-eclim--project-dir
(directory-file-name
- (company-locate-dominating-file buffer-file-name ".project")))
+ (expand-file-name
+ (company-locate-dominating-file buffer-file-name ".project"))))
company-eclim--project-dir))
(defun company-eclim--project-name ()
(company-eclim--project-dir)))
(project-name (company-eclim--project-name)))
(when company-eclim-auto-save
- (save-buffer)
+ (when (buffer-modified-p)
+ (basic-save-buffer))
;; FIXME: Sometimes this isn't finished when we complete.
(company-eclim--call-process "java_src_update"
"-p" (company-eclim--project-name)