From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Haselwarter Newsgroups: gmane.emacs.help,gmane.emacs.jdee.user Subject: Re: JDEE help Date: Sat, 15 Sep 2012 20:39:41 +0200 Message-ID: <87627fku4y.fsf@haselwarter.org> References: <87har0onhj.wl%f@mazzo.li> <87a9wrpx73.wl%f@mazzo.li> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="EuroFed/Artistic-Assassins/Clinton/TB/cybercash/BMUgrDpkPY" X-Trace: ger.gmane.org 1347734410 27281 80.91.229.3 (15 Sep 2012 18:40:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Sep 2012 18:40:10 +0000 (UTC) Cc: jdee-users@lists.sourceforge.net To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Sep 15 20:40:12 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TCxHo-0002P1-2e for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Sep 2012 20:40:12 +0200 Original-Received: from localhost ([::1]:58366 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCxHk-0006L8-3C for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Sep 2012 14:40:08 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCxHd-0006JS-2K for help-gnu-emacs@gnu.org; Sat, 15 Sep 2012 14:40:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TCxHb-0006QQ-5B for help-gnu-emacs@gnu.org; Sat, 15 Sep 2012 14:40:00 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:37866) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TCxHa-0006Q7-Qj for help-gnu-emacs@gnu.org; Sat, 15 Sep 2012 14:39:59 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TCxHc-0002HX-DL for help-gnu-emacs@gnu.org; Sat, 15 Sep 2012 20:40:00 +0200 Original-Received: from 89-156-120-41.rev.numericable.fr ([89.156.120.41]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 15 Sep 2012 20:40:00 +0200 Original-Received: from philipp by 89-156-120-41.rev.numericable.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 15 Sep 2012 20:40:00 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Followup-To: gmane.emacs.help Original-Lines: 251 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 89-156-120-41.rev.numericable.fr User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.50 (gnu/linux) X-NSA-Fodder: Nigeria Chemical agent Mudslide Operation Iraqi Freedom Cancel-Lock: sha1:1x/eeLKshK1S6w8iBrJ87IRe63c= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:86799 gmane.emacs.jdee.user:637 Archived-At: --EuroFed/Artistic-Assassins/Clinton/TB/cybercash/BMUgrDpkPY Content-Type: text/plain Here's the java section from my config; it's kind of hacky but it used to wort for auto-complete and flyspell. It hasn't been tested in about a year and could certainly use some clean-up. I also throw in an example prj.el. Personally I hope that cedet will some time soon get to the point where it fulfills most java requirements. It might actually be there already (haven't coded in java for some time); it's certainly the way to go. --EuroFed/Artistic-Assassins/Clinton/TB/cybercash/BMUgrDpkPY Content-Type: application/emacs-lisp Content-Disposition: inline Content-Transfer-Encoding: quoted-printable ;; {{{2 java (require 'jde-autoload nil 'noerror) (eval-after-load "cc-mode" '(add-hook 'java-mode-hook 'my-init-java)) (defun my-init-java () "Make sure cedet gets loaded before jde" (progn (setq jde-check-version-flag nil) (when (require 'cedet nil 'noerror) (require 'cedet-loaddefs nil 'noerror) (require 'cedet nil 'noerror) (require 'semantic-load nil 'noerror) (require 'semantic-loaddefs nil 'noerror) (require 'semantic/wisent/java nil 'noerror) (require 'jde nil 'noerror) (remove-hook 'java-mode-hook 'my-init-java)))) (defun my-jde-set-flymake-base-dir () "Set `flymake-base-dir' to the dirname of `jde-buffer-project-file'. Verifies first if `jde-compiler' is set to ecj and the project-file is set." (when (buffer-file-name) (setq flymake-base-dir (if (and (boundp 'jde-compiler) (listp (car jde-compiler)) (string-match "eclipse java compiler server" (caar jde-compil= er)) (bound-and-true-p jde-buffer-project-file) (not (equal "" jde-buffer-project-file))) (file-name-directory jde-buffer-project-file) (or (locate-dominating-file (buffer-file-name) "GNUmakefile") (locate-dominating-file (buffer-file-name) "Makefile")))))) (defun my-jde-set-ecj-compiler () "set up flymake using the eclipse batch compiler use find to locate the .jar (filename contains version number)" (let ((ecj (shell-command-to-string (concat "find /usr/share/eclipse/plugins " "-name 'org.eclipse.jdt.core_*.jar' " "| head -n1 | tr -d '\n'")))) (when (and (bound-and-true-p ecj) (not (equal ecj ""))) (setq jde-compiler `(("eclipse java compiler server" ,ecj))) (eval-after-load "flymake" '(progn (require 'jde-ecj-flymake) (let ((cons-cell (assoc "\\.java\\'" flymake-allowed-file-name-masks)) (java-flym '("\\.java\\'" jde-ecj-server-flymake-init jde-ecj-flymake-cleanup))) ;; ("\\.java\\'" jde-ecj-flymake-init jde-ecj-flymake-cleanup) (if cons-cell (setcdr cons-cell (cdr java-flym)) (push java-flym flymake-allowed-file-name-masks)))))))) (eval-after-load "jde-util" '(progn (setq jde-check-version-flag nil) ;; TODO: this is for newtrunk/emacs-cedet (defun senator-minor-mode (&ignore) t) (defun semantic-add-minor-mode (a b &optional c) (my-semantic-add-minor-mode-backup a b)) (defun my-semantic-add-minor-mode-backup (toggle name) "Register a new Semantic minor mode. TOGGLE is a symbol which is the name of a buffer-local variable that is toggled on or off to say whether the minor mode is active or not. It is also an interactive function to toggle the mode. NAME specifies what will appear in the mode line when the minor mode is active. NAME should be either a string starting with a space, or a symbol whose value is such a string." (let ((mm (assq toggle semantic-minor-mode-alist))) (if mm (setcdr mm (list name)) (setq semantic-minor-mode-alist (cons (list toggle name) semantic-minor-mode-alist)))) (semantic-mode-line-update) (when (boundp (quote desktop-minor-mode-handlers)) (add-to-list (quote desktop-minor-mode-handlers) (cons toggle (quote semantic-desktop-ignore-this= -minor-mode))))) (my-init-java) (setq jde-read-make-args t jde-which-method-format '("[" (:propertize jde-which-method-curr= ent face which-func) "]") jde-mode-line-format (my-insert-before `(jde-which-method-mode ("" ,jde-which-method-format " ")) 'mode-line-position mode-line-format)) (add-hook 'java-mode-hook 'my-flymake-minor-mode-on) (add-hook 'java-mode-hook 'my-jde-set-flymake-base-dir) ;; (add-hook 'java-mode-hook '(lambda () (undo-tree-mode -1))) ;; jde-compile-option-directory '("../../../bin" ;; jde-global-classpath '("../../../bin" ".") (my-jde-set-ecj-compiler))) (defun my-java-comment-style-multiline nil (interactive) (setq comment-start "/* " comment-end " */" comment-multi-line t comment-quote-nested t comment-start-skip "/\\*+ *" comment-style 'multi-line)) (defun my-java-comment-style-indent nil (interactive) (setq comment-start "// " comment-end "" comment-continue nil comment-multi-line t comment-quote-nested t comment-start-skip "\\(//+\\|/\\*+\\)\\s *" comment-style 'indent)) (add-hook 'java-mode-hook 'subword-mode) (add-hook 'java-mode-hook 'flyspell-prog-mode) (add-hook 'java-mode-hook (lambda () (ispell-change-dictionary "fr"))) (add-hook 'java-mode-hook 'turn-on-auto-fill) (add-hook 'java-mode-hook (lambda () (set-fill-column 80))) (add-hook 'java-mode-hook 'my-java-comment-style-multiline) ;; auto-complete-mode (defun my-ac-jde-documentation (cand) (cadr (assoc-string cand my-ac-jde-doc-list))) (defun my-ac-jde-candidates () (interactive) (setq my-ac-jde-completion-list (my-ac-jde-candidates-1) my-ac-jde-doc-list (mapcar 'my-nrev-consc my-ac-jde-completion-list)) (mapcar 'cdr my-ac-jde-completion-list)) (defun my-jde-autocomplete () (interactive) (auto-complete '(ac-source-jde))) (defun my-ac-jde-candidates-1 () (interactive) (let* ((completion-type 'ac) (pair (jde-parse-java-variable-at-point)) jde-parse-attempted-to-import) ;;resetting jde-complete-current-list (setq jde-complete-current-list nil) (if pair (my-jde-complete-pair (jde-complete-get-pair pair nil) complet= ion-type)))) (defun my-jde-complete-pair (pair completion-type) (let ((access (jde-complete-get-access pair)) completion-list) (progn (if access (setq completion-list (jde-complete-find-completion-for-pair pair nil access)) (setq completion-list (jde-complete-find-completion-for-pair pair))) ;;if the completion list is nil check if the method is in the current ;;class(this) (if (null completion-list) (setq completion-list (jde-complete-find-completion-for-pair (list (concat "this." (car pair)) "") nil jde-complete-private))) ;;if completions is still null check if the method is in the ;;super class (if (null completion-list) (setq completion-list (jde-complete-find-completion-for-pair (list (concat "super." (car pair)) "") nil jde-complete-protected))) ;; (if completion-list ;; (let ((title (concat (car pair) "." ;; (car (cdr pair)) "[...]"))) ;; (if (null completion-type) ;; (jde-complete-choose-completion title (car (cdr pair))) ;; (if (string=3D completion-type "in-line") ;; (progn ;; (setq jde-complete-current-list-index -1) ;; (jde-complete-complete-cycle)) ;; (if (equal completion-type 'ac) ;; completion-list ;; (jde-complete-choose-completion title (car (cdr pair))= t))))) ;; (error "No completion at this point")) ) completion-list)) (defun my-nrev-consc (consc) (nreverse (list (car consc) (cdr consc)))) ;; (makunbound 'ac-source-jde) (ac-define-source jde '((available . (featurep 'jde)) (candidates . my-ac-jde-candidates) (document . my-ac-jde-documentation) (prefix . c-dot-ref) (requires . 0) (symbol . "jde"))) --EuroFed/Artistic-Assassins/Clinton/TB/cybercash/BMUgrDpkPY Content-Type: application/emacs-lisp Content-Disposition: inline Content-Transfer-Encoding: quoted-printable (jde-project-file-version "1.0") (jde-set-variables '(jde-global-classpath '("./bin" "." "*" "/usr/share/java/junit.jar" "/usr/local/eclipse/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/juni= t.jar")) '(jde-make-enable-find t) '(jde-make-working-directory ".") '(jde-compile-option-directory "./bin") '(jde-run-read-app-args t) '(jde-sourcepath (quote ("."))) '(jde-read-make-args t) `(jde-run-working-directory ".") `(tags-file-name ,(expand-file-name "TAGS" (file-name-directory jde-buffer-project-file)))) --EuroFed/Artistic-Assassins/Clinton/TB/cybercash/BMUgrDpkPY Content-Type: text/plain -- Philipp Haselwarter --EuroFed/Artistic-Assassins/Clinton/TB/cybercash/BMUgrDpkPY--