![]() |
|
|||||||||||||
|
Installation NotesIf you are using XEmacs 21.4.4, you already get python-mode.el 4.1 for free, if you've installed the prog-modes package. Follow the instructions below if you want to install the latest python-mode.el version on XEmacs, or if you want to install it in any version of Emacs. Note that python-mode.el version 4.6 is not compatible with any XEmacsen earlier than 21.1 or Emacsen earlier than 20.7.Byte CompilingYou will want to byte-compilepython-mode.el ,
primarily for better performance. Do this by running the
following commands inside X/Emacs:
C-x C-f /path/to/python-mode.el RET M-x byte-compile-file RETYou can safely ignore any byte compiler warnings; they are due to the cross X/Emacsen support. Be sure to see the list of compatibility issues, for special notes about X/Emacs versions and package interactions. |
load-path
python-mode.el
is on your load-path
,
before any version that is distributed with your X/Emacs.
You can use this test:
M-x locate-library RET python-mode RETMake sure this finds the one you expect it to find. If not, you can add this to your
.emacs
file:
(setq load-path (cons "/dir/of/python-mode/" load-path))
.py
files
with python-mode
so that Emacs sets the
major mode properly when you visit such files. This is controlled
by two variables, auto-mode-alist
and
interpreter-mode-alist
. Add the following to your
.emacs
file:
(setq auto-mode-alist (cons '("\\.py$" . python-mode) auto-mode-alist)) (setq interpreter-mode-alist (cons '("python" . python-mode) interpreter-mode-alist))You don't need to do this for XEmacs, since as of at least XEmacs 19.15, these file associations are set by default.
python-mode
with the file
python-mode.elc
. You do this by setting up an
autoload
by adding this to your .emacs
file:
(autoload 'python-mode "python-mode" "Python editing mode." t)Again, you only need to do this with Emacs, since as of at least XEmacs 19.15, this autoload is set up by default.
;;; add these lines if you like color-based syntax highlighting (global-font-lock-mode t) (setq font-lock-maximum-decoration t)