* bug#5498: 23.1; Python-mode: def and class highlight improperly [PATCH]
@ 2010-01-30 4:30 flat0103
2012-06-18 23:09 ` Glenn Morris
0 siblings, 1 reply; 2+ messages in thread
From: flat0103 @ 2010-01-30 4:30 UTC (permalink / raw)
To: 5498
Python's def and class keywords are not highlighted properly. Specifically, they are not highlighted until the class/function name is typing: the source file
def
def foo():
class
class bar:
Will have the second def and class highlighted, but not the first of each. To mirror cc-mode and js2-mode, as well as for general usability( I ended up getting confused and checking back with python documentation on how to define methods when 'def' wasn't highlighted), these should be highlighted even if the name has not yet been attached.
===File /home/nflath/Dropbox/patches/python-highlighting.patch===
Index: python.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/python.el,v
retrieving revision 1.102
diff -u -r1.102 python.el
--- python.el 7 Dec 2009 20:06:31 -0000 1.102
+++ python.el 28 Dec 2009 19:50:30 -0000
@@ -106,9 +106,9 @@
(,(rx symbol-start "None" symbol-end) ; see § Keywords in 2.5 manual
. font-lock-constant-face)
;; Definitions
- (,(rx symbol-start (group "class") (1+ space) (group (1+ (or word ?_))))
+ (,(rx symbol-start (group "class") (? (1+ space) (group (1+ (or word ?_)))))
(1 font-lock-keyword-face) (2 font-lock-type-face))
- (,(rx symbol-start (group "def") (1+ space) (group (1+ (or word ?_))))
+ (,(rx symbol-start (group "def") (? (1+ space) (group (1+ (or word ?_)))))
(1 font-lock-keyword-face) (2 font-lock-function-name-face))
;; Top-level assignments are worth highlighting.
(,(rx line-start (group (1+ (or word ?_))) (0+ space) "=")
============================================================
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-18 23:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-30 4:30 bug#5498: 23.1; Python-mode: def and class highlight improperly [PATCH] flat0103
2012-06-18 23:09 ` Glenn Morris
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).