Emacs: highlighting "self" tweak
Sjoerd Mullender
sjoerd at oratrix.nl
Wed Jul 7 09:31:45 EDT 1999
On Wed, Jul 7 1999 Preston Landers wrote:
> Hello,
>
> This is what I did to highlight 'self' in my Python files.
>
> It's a small (unified context) patch against python-mode.el version
> 3.90, the lastest as far as I know. It shouldn't be too hard to patch
> it against older versions of python-mode (you only need to insert 3
> lines at a certain spot.)
>
> I wish I knew of an easy way to make it a hook instead of a patch. If
> someone can figure that out, I would *love* to hear from you.
You can use this piece of magic in your .emacs file (tested on XEmacs
21.1):
(add-to-list 'after-load-alist
(cons "python-mode"
'((add-to-list (quote python-font-lock-keywords)
(quote ("\\b\\(self\\)[ .,]?"
1 font-lock-type-face))))))
This changes the python-font-lock-keywords variable right after
python-mode is loaded.
-- Sjoerd Mullender <sjoerd.mullender at oratrix.com>
More information about the Python-list
mailing list