From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Pandora Newsgroups: gmane.emacs.devel Subject: perl-mode "::" as word character [patch] Date: Fri, 29 Apr 2005 23:47:18 -0700 Message-ID: <427329F6.5080508@pacbell.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1114965286 12878 80.91.229.2 (1 May 2005 16:34:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 1 May 2005 16:34:46 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 01 18:34:42 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DSHOP-0001N0-1a for ged-emacs-devel@m.gmane.org; Sun, 01 May 2005 18:34:05 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DSHV8-00040h-1a for ged-emacs-devel@m.gmane.org; Sun, 01 May 2005 12:41:02 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DSHQL-0002I6-CP for emacs-devel@gnu.org; Sun, 01 May 2005 12:36:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DSHQH-0002Gc-RJ for emacs-devel@gnu.org; Sun, 01 May 2005 12:36:02 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DSHQG-00020j-Mm for emacs-devel@gnu.org; Sun, 01 May 2005 12:36:01 -0400 Original-Received: from [199.232.41.67] (helo=mx20.gnu.org) by monty-python.gnu.org with esmtp (TLS-1.0:RSA_ARCFOUR_SHA:16) (Exim 4.34) id 1DSHTQ-0001Dq-0G for emacs-devel@gnu.org; Sun, 01 May 2005 12:39:16 -0400 Original-Received: from [63.197.122.98] (helo=synx.dyndns.org) by mx20.gnu.org with esmtp (Exim 4.34) id 1DRlmV-0006ur-RM for emacs-devel@gnu.org; Sat, 30 Apr 2005 02:48:52 -0400 Original-Received: from [127.0.0.1] (localhost [127.0.0.1]) by synx.dyndns.org (Postfix) with ESMTP id AC67F220FB3 for ; Fri, 29 Apr 2005 23:47:18 -0700 (PDT) User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Accept-Language: en-us, en Original-To: emacs-devel@gnu.org X-Enigmail-Version: 0.90.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:36532 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:36532 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Just dropping in for a teeny bit. I was studying font-lock innards the other day and noticed that the perl-mode font lock does a lot of wrangling around the '::' sequence. That's what's used in perl to divide package names from package members. But instead of sticking \\(::\\sw\\)*s in after every \\sw, I noticed it'd be much simpler just to consider the double colon (NOT the single colon) to be a \\sw character. Seems pretty cut and dried, since :: was only introduced to perl as a namespace separator, and can be wholly considered as if it were a word character. Also since my experience has been that print/printf are used like keywords, but act like functions; they could use some special highlighting. As for functions in general, both &\\(\\sw+\\) and \\(\\sw+\\)( match a function name in perl, but perl-mode only highlights the first expression as a function. So... I went and made a patch against CVS, in case anyone else wants to use these three quick little hacks. Index: lisp/progmodes/perl-mode.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/progmodes/perl-mode.el,v retrieving revision 1.56 diff -r1.56 perl-mode.el 207a208 > ;; Fontify print and printf as functions, typically w/o () 208a210,211 > '("\\<\\(print\\|printf\\)\\>" 1 font-lock-function-name-face) > 210c213,214 < '("&\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-function-name-face) - --- > '("&\\(\\sw+\\)" 1 font-lock-function-name-face) > '("\\(\\sw+\\)\\s *(" 1 font-lock-function-name-face) 213,214c217,218 < '("[$*]{?\\(\\sw+\\(::\\sw+\\)*\\)" 1 font-lock-variable-name-face) < '("\\([@%]\\|\\$#\\)\\(\\sw+\\(::\\sw+\\)*\\)" - --- > '("[$*]{?\\(\\sw+\\)" 1 font-lock-variable-name-face) < '("\\([@%]\\|\\$#\\)\\(\\sw+\\(::\\sw+\\)*\\)" - --- > '("[$*]{?\\(\\sw+\\)" 1 font-lock-variable-name-face) > '("\\([@%]\\|\\$#\\)\\(\\sw+\\)" 258a263,264 > ;; Or $PKG::member :: is a word character, really. c.c > ("\\(::\\)" (1 "w")) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFCcyn2B/meY5RuPPQRAlJeAKCruu9fvqzETQhQQTE9TV70WSTLqgCdHsDL R1rwSw/KRWeOvYaGIzb9+iM= =dJBg -----END PGP SIGNATURE-----