From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: flat0103@gmail.com Newsgroups: gmane.emacs.bugs Subject: bug#5498: 23.1; Python-mode: def and class highlight improperly [PATCH] Date: Fri, 29 Jan 2010 23:30:15 -0500 Message-ID: <87ljfg2p0o.fsf@nflath-laptop.i-did-not-set--mail-host-address--so-tickle-me> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1264827984 14697 80.91.229.12 (30 Jan 2010 05:06:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 30 Jan 2010 05:06:24 +0000 (UTC) To: 5498@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 30 06:06:22 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Nb5XH-0000AO-OQ for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Jan 2010 06:06:20 +0100 Original-Received: from localhost ([127.0.0.1]:43411 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nb5XG-00076n-KS for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Jan 2010 00:06:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nb5W7-0006Hb-Pa for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2010 00:05:07 -0500 Original-Received: from [199.232.76.173] (port=44153 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nb5W7-0006H0-9y for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2010 00:05:07 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nb5W5-0000z0-Tn for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2010 00:05:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:56335) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nb5W5-0000ys-JY for bug-gnu-emacs@gnu.org; Sat, 30 Jan 2010 00:05:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Nb5IU-00041v-SW; Fri, 29 Jan 2010 23:51:03 -0500 X-Loop: bug-gnu-emacs@gnu.org Resent-From: flat0103@gmail.com Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Jan 2010 04:51:02 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: report 5498 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.126482702115416 (code B ref -1); Sat, 30 Jan 2010 04:51:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Jan 2010 04:50:21 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nb5Ho-00040b-DR for submit@debbugs.gnu.org; Fri, 29 Jan 2010 23:50:20 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nb5Hm-00040O-NR for submit@debbugs.gnu.org; Fri, 29 Jan 2010 23:50:19 -0500 Original-Received: from mx10.gnu.org ([199.232.76.166]:38303) by fencepost.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nb5Hj-0004AK-Ej for submit@debbugs.gnu.org; Fri, 29 Jan 2010 23:50:15 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nb4yQ-0006XA-Vz for submit@debbugs.gnu.org; Fri, 29 Jan 2010 23:30:19 -0500 Original-Received: from lists.gnu.org ([199.232.76.165]:40728) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Nb4yQ-0006Wu-QG for submit@debbugs.gnu.org; Fri, 29 Jan 2010 23:30:18 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nb4yQ-0000Az-CW for bug-gnu-emacs@gnu.org; Fri, 29 Jan 2010 23:30:18 -0500 Original-Received: from [199.232.76.173] (port=54039 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nb4yQ-0000Aj-2Z for bug-gnu-emacs@gnu.org; Fri, 29 Jan 2010 23:30:18 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Nb4yP-0006Wm-A8 for bug-gnu-emacs@gnu.org; Fri, 29 Jan 2010 23:30:17 -0500 Original-Received: from mail-pz0-f188.google.com ([209.85.222.188]:55900) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Nb4yP-0006Wi-0P for bug-gnu-emacs@gnu.org; Fri, 29 Jan 2010 23:30:17 -0500 Original-Received: by pzk26 with SMTP id 26so358748pzk.26 for ; Fri, 29 Jan 2010 20:30:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:date:message-id:to :subject:mime-version:content-type:content-transfer-encoding; bh=9hhqQyOpBep669/9UJ1QkXbHS//VEklNpVhhzQhzrzk=; b=lw7YZ3UEWswt7BBkVtoBOqSALsycuiBb3de1Tu/0ZbdSwxb16s9sE0IwnwtI+M9CPd 9xiFL69CYrgceYw99Brnj7557ZScaLwrNktoOqAGMzEgxvx9RTBjkn3s0xmJBNQsTGZH t8x792LYxZOhaTjEWmP5UvwM9NaJaQiMZFx64= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:date:message-id:to:subject:mime-version:content-type :content-transfer-encoding; b=pKR/SZKD8BWP9l1WaRuPrs7N1bU5T0ci9T9B0m/QnUAzBwohMqcMgVrFfskFbHyDRT +7ACpWifjkmemTy6S+1Y48nV0KKxiMqzF66W0L48PaO7ctDxd6u5D3CmwcYBwvLydfWz x51j9RLK729Cg1HNwkkhei9VHs/tQ5MDvnSIg= Original-Received: by 10.143.27.17 with SMTP id e17mr1160689wfj.221.1264825816065; Fri, 29 Jan 2010 20:30:16 -0800 (PST) Original-Received: from nflath-laptop (c-98-237-143-237.hsd1.wa.comcast.net [98.237.143.237]) by mx.google.com with ESMTPS id 21sm2177823pzk.15.2010.01.29.20.30.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 29 Jan 2010 20:30:15 -0800 (PST) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 29 Jan 2010 23:51:02 -0500 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:34815 Archived-At: 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) "=") ============================================================