簡體   English   中英

emacs自動完成不適用於jde

[英]emacs auto-complete don't work with jde

我想在emacs中開發java。 我安裝了ecb,jde和自動完成擴展。 每個人都可以很好地工作,而無需啟 但是,當我想一起使用它們時,發生了一些問題。

  1. 自動完成模式不會自動啟動jde,我需要通過Mx自動完成模式啟動它。 如果沒有jde,自動完成模式將自動啟動
  2. 當我在jde中手動啟動自動完成模式時,自動完成功能不正常。 它只是自動完成出現的單詞。

這是我的.emacs內容:

(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.
 )

版本信息是:

emacs : 24.1
auto complete : 1.3.1
ecb : 2.40
cedet : 1.1
elib : 1.0
jdee : 2.4.0.1

要使用jde-mode自動啟動auto-complete-mode jde-mode ,需要將jde-mode添加到ac-modes

(push 'jde-mode ac-modes)

然后,您需要將一個特定於JDEE的源添加到ac-sources 我不確定JDEE與Semantic集成的程度,您可以使用預定義的源代碼:

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

如果沒有,您可能需要使用ac-define-source定義專用ac-define-source 有關示例,請參閱auto-complete-config.el

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM