3

安装后:

[rope]
[ropemode]
[pymacs]
[ropemacs]
[autocomplete 1.3.1]

并配置.emacs

(add-to-list 'load-path "~/.emacs.d/autocomplete1.3.1")
(add-to-list 'load-path "~/share/emacs/lisp/")

(setq py-install-directory "~/share/emacs/lisp/")
(require 'python-mode)

(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-exec "pymacs" nil t)
(autoload 'pymacs-load "pymacs" nil t)
(autoload 'pymacs-autoload "pymacs")

(require 'pymacs)
(pymacs-load "ropemacs" "rope-")
(setq ropemacs-enable-autoimport t)

(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/autocomplete1.3.1/ac-dict")
(ac-config-default)

(require 'auto-complete)
(global-auto-complete-mode t)

我在 之后键入了一个句点sys.,并希望代码完成类似于 Komodo Edit。

不幸的是,我能做到的最好的事情就是按M-/来调出一个分屏代码完成缓冲区。

如何在类似于 Komodo-Edit 的 GNU Emacs 中实现代码补全?

这是一个让我失望的pymacs 错误

4

1 回答 1

1

这是ac-config-default配置 AC 的唯一定义:

(defun ac-config-default ()
  (setq-default ac-sources '(ac-source-abbrev ac-source-dictionary ac-source-words-in-same-mode-buffers))
  (add-hook 'emacs-lisp-mode-hook 'ac-emacs-lisp-mode-setup)
  (add-hook 'c-mode-common-hook 'ac-cc-mode-setup)
  (add-hook 'ruby-mode-hook 'ac-ruby-mode-setup)
  (add-hook 'css-mode-hook 'ac-css-mode-setup)
  (add-hook 'auto-complete-mode-hook 'ac-common-setup)
  (global-auto-complete-mode t))

没有 Python 配置,所以你不能指望 AC 为 Python 工作。

要设置它:

(add-hook 'python-mode-hook 'ac-ropemacs-setup)

无耻的插件:这里是 AC 的备用ropemacs 源 - 因为包含的源不显示文档:https ://github.com/cofi/dotfiles/blob/master/emacs.d/config/cofi-python.el#L75

这里再次配置:

(add-hook 'python-mode-hook (lambda ()
                              (setq ac-source (append ac-source '(ac-source-nropemacs
                                                                  ac-source-nropemacs-dot)))))
于 2012-08-18T01:15:58.010 回答