Emacs做python的编辑器

组里要去python了. 兵马未动, 粮草先行. 趁星期天先把编辑器的工具搞起来. 希望之后做事情能事半功倍. 

虽然很多东西还不知道是啥意思....  以后用到在说. 

参考资料:

1), http://www.emacswiki.org/emacs/?action=browse;oldid=PythonMode;id=PythonProgrammingInEmacs

2), http://www.cnblogs.com/wuhen/articles/1807242.html

 感谢原作者

 

所用工具:

1), emacs  python-mode.el 

     最基本的缩进,等等

2), rope: python 重构的库( 重构到底是啥意思???), 我的最简单的理解是: 能查到python中的类名, 函数名等等... 

3), pymacs:

Pymacs is a powerful tool which, once started from Emacs, allows two-way communication between Emacs Lisp and Python. Pymacs aims to employ Python as an extension language for Emacs rather than the other way around, and this asymmetry is reflected in some design choices. Within Emacs Lisp code, one may load and use Python modules. Python functions may themselves use Emacs services, and handle Emacs Lisp objects kept in Emacs Lisp space.

4), ropemode: 

5), ropemacs: 

 

安装:

rope: http://rope.sf.net/:

   python setup.py install

Pymacs, http://pymacs.progiciels-bpi.ca/pymacs.html

  make; make install;
  之后会生成pymacs.el (这个是emacs 需要的. 放在你能load到的地方) 

ropemode, http://pypi.python.org/pypi/ropemode

  python setup.py install

ropemacs,http://rope.sourceforge.net/ropemacs.html

  python setup.py install

Emacs配置文件:

;;python-mode
(require 'python-mode)
(setq auto-mode-alist (cons '("\\.py$" .  python-mode) auto-mode-alist))
(setq interpreter-mode-alist (cons '("python" .  python-mode) interpreter-mode-alist))

(autoload 'python-mode "python-mode" "Python editing mode." t)

;;rope & pymacs
(require 'pymacs)
(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)

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

 

END:

简单的使用就可以了. 比如可以在emacs中打开pyhton 交互环境等等.  

posted on 2011-11-13 15:51  foreveryl  阅读(687)  评论(0编辑  收藏  举报