Massachusetts Institute of Technology
Dept. of Electrical Engineering and Computer Science
Fall Semester, 2007
6.01: Introduction to EECS I

Installing Python for Emacs

A. Download the necessary files

Download the following to your home directory: 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")
;;python
(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)
(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.