The Golden Spot

I hope this helps someone who is learning about Linux and web application programming with Python, Django, and Javascript.

Sunday, December 03, 2006

python syntax highlighting with emacs in Mac os X

mac os x 10.4.8
python 2.5
emacs 21.2.1

tried to get python syntax highlighting with emacs working tonight- succeeded:

downloaded:

- python-mode

- copied all files from download in ~/.emacs.d/
- opened python-mode.el in emacs and typed "M-x byte-compile-file"; file was compiled.

- added the lines in the comment section of the python-mode.el file to my ~/.emacs file
"""
(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)
(setq font-lock-maximum-decoration t)
"""

-added this line to ~/.emacs file
"""
(setq load-path (cons "~/.emacs.d" load-path))
"""

now when I open .py files there is syntax highlighting.

YAY!

Labels: , ,

0 Comments:

Post a Comment

<< Home