Emacs auto-complete does not work with jde

I want to develop java in emacs. I install ecb, jde and auto-complete extensions. Each of them works well, without launching the others. But when I want to use them together, some kind of problem arose.

  • Auto-complete mode does not start automatically with jde, I need to start it with Mx auto-complete-mode. If without jde, autocomplete will automatically start
  • When I manually run auto-full mode in jde, autocomplete does not work. It just automatically fills in the word that appears.

Here is my .emacs content:

(global-linum-mode 1) (setq linum-format "%2d| ") (setq default-tab-width 4) (setq debug-on-error t) ;;no backup file (setq make-backup-files nil) (setq debug-on-error t) ;;auto complete config (add-to-list 'load-path "D:/emacs-24.1/custom_el/auto-complete-1.3.1") (require 'auto-complete-config) (add-to-list 'ac-dictionary-directories "D:/emacs-24.1/custom_el/auto-complete-1.3.1/dict") (ac-config-default) (setq stack-trace-on-error t) (add-to-list 'load-path (expand-file-name "D:/emacs-24.1/custom_el/jdee-2.4.0.1/lisp")) (add-to-list 'load-path (expand-file-name "D:/emacs-24.1/custom_el/cedet-1.1/common")) (add-to-list 'load-path (expand-file-name "D:/emacs-24.1/custom_el/elib-1.0")) (add-to-list 'load-path' "d:/emacs-24.1/custom_el/ecb-2.40") ;; Initialize CEDET. (load-file (expand-file-name "D:/emacs-24.1/custom_el/cedet-1.1/common/cedet.el")) (load-file (expand-file-name "D:/emacs-24.1/custom_el/ecb-2.40/ecb.el")) (require 'ecb) (ecb-activate) (ecb-byte-compile) ;; If you want Emacs to defer loading the JDE until you open a ;; Java file, edit the following line (setq defer-loading-jde nil) ;; to read: ;; ;; (setq defer-loading-jde t) ;; (if defer-loading-jde (progn (autoload 'jde-mode "jde" "JDE mode." t) (setq auto-mode-alist (append '(("\\.java\\'" . jde-mode)) auto-mode-alist))) (require 'jde)) ;; Sets the basic indentation for Java source files ;; to two spaces. (defun my-jde-mode-hook () (setq c-basic-offset 2)) (add-hook 'jde-mode-hook 'my-jde-mode-hook) (custom-set-variables ;; custom-set-variables was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. '(ecb-options-version "2.40") '(ecb-primary-secondary-mouse-buttons (quote mouse-1--C-mouse-1))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. ) 

Version Information:

 emacs : 24.1 auto complete : 1.3.1 ecb : 2.40 cedet : 1.1 elib : 1.0 jdee : 2.4.0.1 
+4
source share
1 answer

To autostart auto-complete-mode using jde-mode , you need to add jde-mode to ac-modes :

 (push 'jde-mode ac-modes) 

Then you need to add the JDEE source for ac-sources . I'm not sure about the degree of integration of JDEE with Semantic, you can use a predefined source for it:

 (add-hook 'jde-mode-hook (lambda () (push 'ac-source-semantic ac-sources))) 

If not, you may need to define a specialized source using ac-define-source . See auto-complete-config.el for examples.

+1
source

All Articles