Massachusetts Institute of Technology
Dept. of Electrical Engineering and Computer Science
Spring Semester, 2007
6.081: Introduction to EECS 1

Installing Python for Emacs

A. Download the necessary files

Download the following files to your home directory: doctest-mode.el, pycomplete.el, pycomplete.rename (rename the extension to .py), and python-mode.el.

B. Changing the configuration file for emacs

Edit your .emacs file in your home directory to include the following:

(load "~/python-mode.el")
(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist (cons '("python" . python-mode)
(autoload 'python-mode "python-mode" "Python editing mode." t)

(global-font-lock-mode t)
(font-lock-mode +1)

C. Check that Python works

Create a new file that ends in ".py". If you see Python by your file name, then your installation should be working. If you have any problems installing python using these instructions, please ask the staff for help.