unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: flat0103@gmail.com
To: 5498@debbugs.gnu.org
Subject: bug#5498: 23.1; Python-mode: def and class highlight improperly [PATCH]
Date: Fri, 29 Jan 2010 23:30:15 -0500	[thread overview]
Message-ID: <87ljfg2p0o.fsf@nflath-laptop.i-did-not-set--mail-host-address--so-tickle-me> (raw)

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	other threads:[~2010-01-30  4:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-30  4:30 flat0103 [this message]
2012-06-18 23:09 ` bug#5498: 23.1; Python-mode: def and class highlight improperly [PATCH] Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ljfg2p0o.fsf@nflath-laptop.i-did-not-set--mail-host-address--so-tickle-me \
    --to=flat0103@gmail.com \
    --cc=5498@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).