From 2f8064238b6613dcbd240d7eda05a77b275e3fc6 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Mon, 20 Apr 2009 21:53:44 +0200 Subject: [PATCH 1/4] Added README file --- README | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 README diff --git a/README b/README new file mode 100644 index 0000000..d1bbfdd --- /dev/null +++ b/README @@ -0,0 +1,66 @@ +OVERVIEW +======== + +Eclim is an Eclipse plugin which exposes Eclipse features through a +server interface. When this server is started, the command line utility +eclim can be used to issue requests to that server. + +Eclim can be found at http://eclim.sourceforge.net/. + +INSTALLATION +============ + +Get the installer for your platform from the Eclim downloads page and +follow those instructions. After the install procedure, you should have +the eclim and eclimd executables in + + $ECLIPSE_HOME/eclimd + $ECLIPSE_HOME/plugins/org.eclim_1.4.5/bin/eclim + +It might be convenient to drop a shellscript like + +--8<---------------cut here---------------start------------->8--- +#!/bin/sh +$ECLIPSE_HOME/plugins/org.eclim_1.4.5/bin/eclim $* +--8<---------------cut here---------------end--------------->8--- + +into your PATH. + +USAGE +===== + +To start using eclim, first you have to start the eclimd server process. +Here are two possibilities: + + 1. Simply execute the eclimd executable. This will start a headless + eclipse instance in the background, so you have to do all your work + in emacs. + + 2. Start Eclipse as usual and open the eclimd view, which starts the + server, too. + + Show View -> Other -> Eclim -> eclimd + +Now you can issue commands via eclim. As a starter, let's see which +projects are in the current workspace. The output should look like +that: + +--8<---------------cut here---------------start------------->8--- +% eclim -command project_list +GraBaJa - closed - /home/horn/uni/repos/grabaja +GretlTest - closed - /home/horn/workspace/GretlTest +JDT - closed - /home/horn/workspace/JDT +SCLTest - closed - /home/horn/workspace/SCLTest +eclim - closed - /home/horn/repos/eclim +greqlscript - closed - /home/horn/uni/repos/greqlscript +gretl - open - /home/horn/uni/repos/gretl +jgStreetMap - closed - /home/horn/uni/repos/jgstreetmap +jgralab - open - /home/horn/uni/repos/jgralab +jgwnl - closed - /home/horn/uni/repos/jgwnl +rsleditor - closed - /home/horn/uni/repos/rsleditor +sclschema - closed - /home/horn/uni/repos/sclschema +sidiffadapter - closed - /home/horn/uni/repos/sidiffadapter +swank - closed - /home/horn/workspace/swank +--8<---------------cut here---------------end--------------->8--- + +For more commands refer to the eclim docs and source code. -- 2.11.4.GIT From 99a40958da2888662b6dcd7093bc788d85cc66dc Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Sat, 25 Apr 2009 12:42:03 +0200 Subject: [PATCH 2/4] Added some infrastructure --- eclim.el | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 eclim.el diff --git a/eclim.el b/eclim.el new file mode 100644 index 0000000..a44b54f --- /dev/null +++ b/eclim.el @@ -0,0 +1,86 @@ + +;;* Eclim + +(eval-when-compile (require 'cl)) + +;;** Basics + +(defgroup eclim nil + "Interface to the Eclipse IDE." + :group 'tools) + +(defun eclim-executable-find () + (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))) + (setq file (car (last (directory-files file t "^org.eclim_")))) + (file-exists-p (setq file (expand-file-name "bin/eclim" file))) + (return file))))) + +(defcustom eclim-executable + (or (executable-find "eclim") (eclim-executable-find)) + "Location of eclim executable." + :group 'eclim + :type 'file) + +(defcustom eclim-auto-save nil + "Determines whether to save the buffer when retrieving completions. +eclim can only complete correctly when the buffer has been +saved." + :group 'eclim + :type '(choice (const :tag "Off" nil) + (const :tag "On" t))) + +(defvar eclim--project-dir nil) +(make-variable-buffer-local 'eclim--project-dir) + +(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) + (while (= 0 (forward-line -1)) + (push (buffer-substring-no-properties (line-beginning-position) + (line-end-position)) + lines)) + lines)) + +(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") + nil)))) + +(defun eclim--project-dir () + "Return this file's project root directory." + (or eclim--project-dir + (setq eclim--project-dir + (directory-file-name + (expand-file-name + (locate-dominating-file buffer-file-name ".project")))))) + +(defun eclim--project-name () + (or eclim--project-name + (setq eclim--project-name + (car (cddr (assoc (eclim--project-dir) + (eclim/project-list))))))) + +(defun eclim/project-list () + (mapcar (lambda (line) (nreverse (split-string line " *- *" nil))) + (eclim--call-process "project_list"))) + +(define-minor-mode eclim-mode + "An interface to the Eclipse IDE." + nil + "Eclim" + (eclim--project-name) + ) \ No newline at end of file -- 2.11.4.GIT From c4167ccfba270ab485c743a8a272dfab49f5adbd Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Tue, 28 Apr 2009 13:08:18 +0200 Subject: [PATCH 3/4] GPL header, defined minor mode --- eclim.el | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/eclim.el b/eclim.el index a44b54f..de6b031 100644 --- a/eclim.el +++ b/eclim.el @@ -1,3 +1,29 @@ +;; eclim.el --- an interface to the Eclipse IDE. +;; +;; Copyright (C) 2009 Tassilo Horn +;; +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . +;; +;;; Contributors +;; +;; - Nikolaj Schumacher +;; +;;; Conventions +;; +;; Conventions used in this file: Name internal variables and functions +;; "eclim--", and name eclim command invocations +;; "eclim/command-name", like eclim/project-list. ;;* Eclim @@ -78,9 +104,22 @@ saved." (mapcar (lambda (line) (nreverse (split-string line " *- *" nil))) (eclim--call-process "project_list"))) +;;** The minor mode and its keymap + +(defvar eclim-mode-map + (let ((map (make-sparse-keymap))) + ) + "The keymap used in `eclim-mode'.") + (define-minor-mode eclim-mode "An interface to the Eclipse IDE." nil "Eclim" - (eclim--project-name) - ) \ No newline at end of file + eclim-mode-map + (if eclim-mode + (progn + ;; Set project dir and name. + (eclim--project-dir) + (eclim--project-name)) + (kill-local-variable 'eclim--project-dir) + (kill-local-variable 'eclim--project-name))) -- 2.11.4.GIT From 5a83f560550897430ba336080d01a42bb320c90e Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Tue, 28 Apr 2009 16:57:32 +0200 Subject: [PATCH 4/4] better eclim error messages --- eclim.el | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/eclim.el b/eclim.el index de6b031..ddef1b5 100644 --- 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))) + -- 2.11.4.GIT