Emacs: highlighting "self" tweak
Preston Landers
mithy at my-deja.com
Wed Jul 7 02:06:38 EDT 1999
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.
I decided to make it color 'self' as a type (same color as classes),
because that's the best I could think of.
If this patch comes across mangled or whatever, you can always pick
it up at my Python page:
http://askpreston.com/projects/python/
You can also find my silly little Emacs/Python shortcut hook there.
cheers,
---Preston
--------cut here
--- python-mode.el Tue Jul 6 23:37:55 1999
+++ /usr/share/xemacs20/site-lisp/python-elisp/python-mode.el Tue Jul 6
23:30:48 1999
@@ -316,6 +316,9 @@
;; functions
'("\\bdef[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)"
1 font-lock-function-name-face)
+ ;; also color "self" as a 'type'
+ '("\\b\\(self\\)[ .,]?"
+ 1 font-lock-type-face)
))
"Additional expressions to highlight in Python mode.")
(put 'python-mode 'font-lock-defaults '(python-font-lock-keywords))
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
More information about the Python-list
mailing list