Emacs的自动完成不工作JDE [英] emacs auto-complete don't work with jde

查看:157
本文介绍了Emacs的自动完成不工作JDE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要开发Java在Emacs。我安装ECB,JDE和自动完成扩展。每一件作品很好,但不启动其他。但是,当我想同时使用它们,有些问题发生了。


  1. 自动完成模式不会自动启动与JDE,我需要用M-X自动完成模式启动它。如果没有JDE,自动完成模式会自动启动

  2. 当我手动启动JDE自动完成模式,自动完成功能无法正常工作。它只是自动完成所出现的单词。

下面是我的.emacs内容:

 (全球亚麻模式1)
(setq亚麻格式%2D |)(setq默认标签宽度4)(setq调试上错误T);;没有备份文件
(setq化妆备份文件无)(setq调试上错误T);;自动完成配置
(添加到列表负载路径D:/emacs-24.1/custom_el/auto-complete-1.3.1)
(需要自动完成-配置)
(添加到列表AC-字典的目录D:/emacs-24.1/custom_el/auto-complete-1.3.1/dict)
(AC-配置默认)(setq堆栈跟踪上错误T)(添加到列表负载路径(扩展文件名D:/emacs-24.1/custom_el/jdee-2.4.0.1/lisp))
(添加到列表负载路径(扩展文件名D:/emacs-24.1/custom_el/cedet-1.1/common))
(添加到列表负载路径(扩展文件名D:/emacs-24.1/custom_el/elib-1.0))(添加到列表负载路径D:/emacs-24.1/custom_el/ecb-2.40)
;;初始化CEDET。
(负载文件(扩展文件名D:/emacs-24.1/custom_el/cedet-1.1/common/cedet.el))
(负载文件(扩展文件名D:/emacs-24.1/custom_el/ecb-2.40/ecb.el))
(需要'ECB)
(ECB-激活)
(ECB字节编译)
;;如果你想Emacs的推迟加载JDE,直到你打开
;; Java的文件中,编辑下面一行
(setq延迟加载-JDE无)
;;读书:
;;
;; (setq延迟加载-JDE T)
;;(如果延迟加载,JDE
    (progn这个
      (自动加载JDE模式JDE,JDE模式。T)
      (setq自动模式ALIST
        (附加
         '((\\\\。java的\\\\'。JDE模式))
         自动模式ALIST)))
 (需要'JDE))
;;设置Java源文件的基本缩进
;;两个空格。
(defun函数我-JDE模式挂机()
  (setq C-基本偏移2))(添加钩'JDE模式钩'我-JDE模式钩)(自定义设置变量
 ;;自定义设置的变量是由自定义添加。
 ;;如果你手工编辑它,你可以搞砸了,所以要小心。
 ;;您的init文件应该只包含一个这样的例子。
 ;;如果有不止一个,他们将无法正常工作的权利。
 '(ECB选项版2.40)
 '(ECB-初级次级鼠标按钮(报价小鼠-1 - C-小鼠-1)))
(自定义设置的面孔
 ;;自定义设置的面孔被定制添加。
 ;;如果你手工编辑它,你可以搞砸了,所以要小心。
 ;;您的init文件应该只包含一个这样的例子。
 ;;如果有不止一个,他们将无法正常工作的权利。
 )

版本信息是:

 的emacs:24.1
自动完成:1.3.1
欧洲央行:2.40
CEDET:1.1
ELIB:1.0
JDEE:2.4.0.1


解决方案

要自启动自动完成模式 JDE模式,需要 JDE模式添加到 AC-模式

 (推JDE型AC-模式)

然后,你需要一个特定的JDEE代码添加到 AC-源。我不知道用语义整合JDEE的程度,您可以使用pre-定义它的源代码:

 (添加钩'JDE模式钩(拉姆达()(推AC-源语义交流源)))

如果没有,你可能需要定义与专门源AC-定义源。参见自动完成-config.el 的例子。

I want to develop java in emacs. I install ecb, jde and auto-complete extensions. Each one works well without starting others. But when i want to use them together, some problem happened.

  1. auto-complete-mode doesn't auto start with jde, I need to start it by M-x auto-complete-mode. If without jde, auto-complete-mode will auto start
  2. When I manually start the auto-complete-mode in jde, the auto complete is not work well. It just auto complete the word that is appeared.

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

The version info is :

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

解决方案

To auto-start auto-complete-mode with jde-mode, you need to add jde-mode to ac-modes:

(push 'jde-mode ac-modes)

Then you need to add a JDEE-specific source to ac-sources. I'm not sure of the extent of JDEE integration with Semantic, you may be able to use the pre-defined 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 with ac-define-source. See auto-complete-config.el for examples.

这篇关于Emacs的自动完成不工作JDE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆