better eclim error messagesmaster
authorTassilo Horn <tassilo@member.fsf.org>
Tue, 28 Apr 2009 14:57:32 +0000 (28 16:57 +0200)
committerTassilo Horn <tassilo@member.fsf.org>
Tue, 28 Apr 2009 18:16:31 +0000 (28 20:16 +0200)
eclim.el

index de6b031..ddef1b5 100644 (file)
--- a/eclim.el
+++ b/eclim.el
@@ -39,7 +39,8 @@
   (let (file)
     (dolist (eclipse-root '("/Applications/eclipse" "/usr/lib/eclipse"
                             "/usr/local/lib/eclipse"))
-      (and (file-exists-p (setq file (expand-file-name "plugins" eclipse-root)))
+      (and (file-exists-p
+            (setq file (expand-file-name "plugins" eclipse-root)))
            (setq file (car (last (directory-files file t "^org.eclim_"))))
            (file-exists-p (setq file (expand-file-name "bin/eclim" file)))
            (return file)))))
@@ -64,9 +65,6 @@ saved."
 (defvar eclim--project-name nil)
 (make-variable-buffer-local 'eclim--project-name)
 
-(defvar eclim--doc nil)
-(make-variable-buffer-local 'eclim--doc)
-
 (defun eclim--buffer-lines ()
   (goto-char (point-max))
   (let (lines)
@@ -76,14 +74,22 @@ saved."
             lines))
     lines))
 
+(defun eclim--error-buffer (text)
+  (let ((errbuf (get-buffer-create "*Eclim errors*")))
+    (set-buffer errbuf)
+    (insert text)
+    (setq buffer-read-only t)
+    (display-buffer errbuf t)))
+
 (defun eclim--call-process (&rest args)
   (let ((coding-system-for-read 'utf-8))
     (with-temp-buffer
       (if (= 0 (apply 'call-process eclim-executable nil t nil
                       "-command" args))
           (eclim--buffer-lines)
-        ;; TODO: A more meaningful error message
-        (message "Eclim command failed")
+        (eclim--error-buffer
+         (buffer-substring-no-properties
+          (point-min) (point-max)))
         nil))))
 
 (defun eclim--project-dir ()
@@ -123,3 +129,4 @@ saved."
         (eclim--project-name))
     (kill-local-variable 'eclim--project-dir)
     (kill-local-variable 'eclim--project-name)))
+