今天折腾了一天Emacs的python自动补全功能,先是下载了ipython,Rp不好导致各种失败,没办法,只好用pycomplete了。
pycomplete有种,一个是launchpad上的,一个是
首先,需要装上Pymacs,需要的就是make一下pymacs目录,然后将pymacs.el扔进Emacs的加载路径,pymacs.py扔进Python的加载路径。
然后下载python-mode.el,也放进Emacs加载路径,
接下来在.emacs添加:
;; python-mode settings
(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist(cons '("python" . python-mode)
interpreter-mode-alist))
;; path to the python interpreter, e.g.: ~rw/python27/bin/python2.7
(setq py-python-command "python")
(autoload 'python-mode "python-mode" "Python editing mode." t)
;; pymacs settings
(setq pymacs-python-command py-python-command)
(autoload 'pymacs-load "pymacs" nil t)
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(require 'pycomplete)
这个插件只实现了5个功能:
code completion hitting (or ) key: e.g.: time.cl -> time.clock time. -> list of possible choices
description of the element (function/module/class/keyword) at the point hitting key
hitting ‘(‘ and ‘,’ shows funtion signature e.g.: time.strftime( -> strftime(format[, tuple]) -> string
getting signature of a given function name
getting description of a given element name
初学阶段就这几个足够了,先用着吧。