I had some trouble setting up emacs (on the command line) in OS 10.4
to recognize Python files, so here are the steps I followed.
- Make a folder "~/emacs" in your home directory to put your
emacs configuration files.
- Download the python-mode files from
here,
and untar them into the newly created "~/emacs" folder. This
should create a folder named "python-mode-1.0.0".
- Open the file "~/.emacs.el" and add the following text:
;; Set my default load-path
(setq load-path (append '("~/emacs") load-path))
;; To make only spaces from the tab character (useful for python)
(setq tab-width 4)
;; To setup Python mode
(setq load-path (append '("~/emacs/python-mode-1.0") load-path))
(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)
;; For colored syntax highlighting
(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)
One can also use Aquamacs
from the command line (though it launches in a new window).
To do this, install Aquamacs and make an alias by
adding
alias aquamacs='open -a /Applications/Aquamacs\ Emacs.app/'
to your "~/.bashrc" file (if you're using the bash shell).
I like it's color scheme better than python-mode.el, but the
drawback is that it cannot
be run completely within a terminal. (Added 12/2/2007)