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

Installing Python for Emacs on Athena

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

  1. Start emacs by typing the command:
    athena% emacs
    in the terminal window prompt.

  2. In emacs, type C-x C-f and type in .emacs. That file should reside in your home directory.

  3. Make sure you add the following lines to the file. Note that the first line should be different from yours, and you must edit it for your athena locker.
    (load "/afs/athena.mit.edu/user/s/h/shirleyf/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)

  4. Save the file by typing C-x C-s.

  5. Restart Emacs.

C. Check that Python works

Use C-x C-f to 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.