Emacs trick: adding Python mode to Emacs

Drop python-mode.el into site-lisp (in Carbon Emacs, it is in /Applications/Emacs.app/Contents/Resources/share/emacs/site-lisp/); byte-compile it,

C-x C-f /path/to/python-mode.el RET
M-x byte-compile-file RET

then modify .emacs to autoload,

(autoload `python-mode "python-mode" "Python editing mode." t)

to associate files,

(setq auto-mode-alist
      (cons `("\\.py$" . python-mode) auto-mode-alist))
(setq interpreter-mode-alist
      (cons `("python" . python-mode)

and to have syntax highlighting by default,

(global-font-lock-mode t)
(setq font-lock-maximum-decoration t)


Apr 11, 2016

emacs-python-mode (/progtricks)
2016-04-11, 14:59 [edit]

  Login:   Password:   [rss] [cc] [w3] [css]

© M. Vallisneri 2012 — last modified on 2010/01/29

Tantum in modicis, quantum in maximis