bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#5498: 23.1; Python-mode: def and class highlight improperly [PATCH]


From: flat0103
Subject: bug#5498: 23.1; Python-mode: def and class highlight improperly [PATCH]
Date: Fri, 29 Jan 2010 23:30:15 -0500

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) "=")
============================================================







reply via email to

[Prev in Thread] Current Thread [Next in Thread]