在Mac OS X上设置Python Emacs环境

3 投票
1 回答
3020 浏览
提问于 2025-04-17 07:44

我按照这个教程设置了一个Python的Emacs环境。

http://www.saltycrane.com/blog/2010/05/my-emacs-python-environment/

我已经在Emacs中成功启用了Python模式,并且可以看到语法高亮,但当我尝试使用rope和ropemacs,比如用C-c d这个命令来查看文档时,系统提示这个命令没有定义。

我通过easy install安装了rope和ropemacs,而我的.emacs文件看起来是这样的:我是不是漏掉了什么?

(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.
 '(custom-enabled-themes (quote (tango-dark))))
(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.
 )
 (add-hook 'find-file-hook 'flymake-find-file-hook)
 (provide 'init_python)


(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)
(eval-after-load "pymacs"
   '(add-to-list 'pymacs-load-path ~/.emacs.d/vendor/pymacs-0.24-beta2"))

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


(add-to-list 'load-path "~/.emacs.d/vendor/auto-complete-1.2")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/vendor/auto-complete-1.2/dict")
(ac-config-default)

1 个回答

0

你需要把你的ropeemacs文件夹添加到加载路径中,这样EMACS才能找到这个包,并为你加载相关的命令。

(setq load-path (cons "/PATH-OF-ROPEEMACS"      load-path))

老实说,我觉得rope emacs对我来说没什么用,它让EMACS启动变得很慢,但好处并不是特别明显。当我想查找问题时,我直接去Stack Overflow。

撰写回答