Emacs Setup for Python Development on Debian Squeeze

This a brief description of how to install emacs as a python development environment on a Debian Squeeze.

If emacs is not installed than install it with apt:
$ sudo apt-get install emacs


Than install the following packages using apt:
$ sudo apt-get install python-mode pymacs auto-complete-el yasnippet pyflakes


However python-rope and python-ropemacs packages are available in the debian repository they are not working perfectly, so these packages should be installed by the python way, to do this we need the python-setuptools package:
$ sudo apt-get install python-setuptools

Now we have ease_install, so use it to install rope and ropemacs:
$ sudo easy_install rope
$ sudo easy_install ropemacs

If easy_install could not find ropemacs you can download and install it manually from http://bitbucket.org/agr/ropemacs

Create a file which initializes the installed modules and name it to init-python.el and put it into your .emacs.d directory.

Add the following lines into your emacs config:

(add-to-list 'load-path "~/.emacs.d/")
(progn (cd "~/.emacs.d")
(normal-top-level-add-subdirs-to-load-path))

; python setup
(require 'smart-operator)
(require 'auto-complete)
(global-auto-complete-mode t)
(require 'yasnippet)
(yas/initialize)
(yas/load-directory "~/.emacs.d/snippets")
(load-library "auto-complete-yasnippet")
(load-library "init-python")


Ok, everything is ready let's try it. Start your emacs type and press TAB to complete, if everything is ok a popup should be appeared with the available completion:



Check C-h m to show key bindings.

References:
1. http://hide1713.wordpress.com/2009/01/30/setup-perfect-python-environment-in-emacs/
2. http://www.enigmacurry.com/category/emacs

No comments: