From xemacs-m  Sun Jun 22 11:02:18 1997
Received: from steadfast.teradyne.com (steadfast.teradyne.com [131.101.1.200])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id LAA16822
	for <xemacs-beta@xemacs.org>; Sun, 22 Jun 1997 11:02:18 -0500 (CDT)
Received: from engine.ecf.teradyne.com (engine.ecf.teradyne.com [131.101.192.6]) by steadfast.teradyne.com (8.7.1/8.7.1) with ESMTP id MAA01455; Sun, 22 Jun 1997 12:06:17 -0400 (EDT)
Received: (from aichner@localhost) by engine.ecf.teradyne.com (8.7.1/8.7.1) id SAA02313; Sun, 22 Jun 1997 18:01:40 +0200 (MET DST)
To: Martin Buchholz <mrb@Eng.Sun.COM>
Cc: XEmacs Beta Mailing List <xemacs-beta@xemacs.org>,
        ilya@math.mps.ohio-state.edu, arius@informatik.uni-erlangen.de
Subject: Re: cperl-mode syntax table problem/fix?
References: <rxsen9y4ib3.fsf@midnight.ecf.teradyne.com> <199706200057.RAA05477@xemacs.eng.sun.com>
X-Face: 4[iHdXiTu\V3u[~\I)<f9HC);%~nG8`oUqv#uzvs6=\V{AjN6Sn
 c/qi;YLwRmEbt8Y*=j5n(urqY@chPh@J'D"QlqD!C8>*}#kYF[-tYl3VZga/HSOP|K,{L
 Rtu@f0y/=O&Cu}\:~d|P$JON?pn?j,&CnPb1z#/TL9bkAJwyol&a:SvYj-VYbM=Dtxhk9
 =w|R6U3_;SH&B<Mfy6Q%#
Mime-Version: 1.0 (generated by tm-edit 7.108)
Content-Type: multipart/mixed;
 boundary="Multipart_Sun_Jun_22_18:01:40_1997-1"
Content-Transfer-Encoding: 7bit
From: Adrian Aichner <aichner@ecf.teradyne.com>
Date: 22 Jun 1997 18:01:40 +0200
In-Reply-To: Martin Buchholz's message of "Thu, 19 Jun 1997 17:57:03 -0700"
Message-ID: <rxsbu4yhbiz.fsf@ecf.teradyne.com>
Lines: 206
X-Mailer: Gnus v5.4.59/XEmacs 20.3(beta8) - "Copenhagen"

--Multipart_Sun_Jun_22_18:01:40_1997-1
Content-Type: text/plain; charset=US-ASCII


Hello Martin, Ilya, Peter,

>>>>> "Martin" == Martin Buchholz <mrb@Eng.Sun.COM> writes:

>>>>> "AA" == Adrian Aichner <aichner@ecf.teradyne.com> writes:

    Martin> I was the one who changed it from word-constituent to
    Martin> symbol-constituent.  If we're going to fix it, let's fix it right.
    Martin> The Emacs standard is for `_' to be a symbol-constituent in those
    Martin> languages where it can be used in a symbol.

After going back into xemacs-beta history (discussions between Kyle
Jones, Barry Warsaw and you) I understand this change now.

I can see the benefit now, of being able to kill words from
a_very_long_identifier_for_a_variable_or_function (M-d) as well as
being able to kill the whole identifier (M-C-k).

    AA> I have not encountered any problems I may have caused by this change.

    Martin> M-d will not work consistently across modes.

Yes.

    Martin> Ilya: I may have forgot to communicate with you when I made this
    Martin> change to the XEmacs sources.  I think it's a mistake to use word
    Martin> syntax for `_' 

Obviously the syntax table change broke font-locking for cperl-mode.

I have tried to patch cperl-mode.el by excluding leading and trailing
context of _ from matches of font-lock-type-face and
font-lock-other-type-face.

Also I have replaced instances or word-constituent-syntax with
word-or-symbol-constituent to re-include _ after the syntax
change. This added a sub-grouping in cperl-not-bad-style-regexp, which 
I found not to be problematic.

I have also excluded trailing _ context from the regexp matching label 
definitions (to be rendered with font-lock-reference-face).

So, here is my patch, which I would like to get some feedback on
(please excuse the $Id keyword overwrite. 1.1 IS cperl-mode.el as
distributed with xemacs-20.3-b7):


--Multipart_Sun_Jun_22_18:01:40_1997-1
Content-Type: application/octet-stream; type=patch
Content-Disposition: attachment; filename="cperl-mode.patch"
Content-Transfer-Encoding: 7bit

*** 1.1	1997/06/19 16:43:13
--- 1.4	1997/06/22 15:13:02
***************
*** 32,38 ****
  ;;; Corrections made by Ilya Zakharevich ilya@math.mps.ohio-state.edu
  ;;; XEmacs changes by Peter Arius arius@informatik.uni-erlangen.de
  
! ;; $Id: cperl-mode.el,v 1.1 1997/06/19 16:43:13 aichner Exp $
  
  ;;; To use this mode put the following into your .emacs file:
  
--- 32,38 ----
  ;;; Corrections made by Ilya Zakharevich ilya@math.mps.ohio-state.edu
  ;;; XEmacs changes by Peter Arius arius@informatik.uni-erlangen.de
  
! ;; $Id: cperl-mode.el,v 1.4 1997/06/22 15:13:02 aichner Exp $
  
  ;;; To use this mode put the following into your .emacs file:
  
***************
*** 2896,2902 ****
  	   (list
  	    (cons
  	     (concat
! 	      "\\(^\\|[^$@%&\\]\\)\\<\\("
  	      (mapconcat
  	       'identity
  	       '("if" "until" "while" "elsif" "else" "unless" "for"
--- 2896,2902 ----
  	   (list
  	    (cons
  	     (concat
! 	      "\\(^\\|[^_$@%&\\]\\)\\<\\("
  	      (mapconcat
  	       'identity
  	       '("if" "until" "while" "elsif" "else" "unless" "for"
***************
*** 2909,2915 ****
  					; for overwritable builtins
  	    (list
  	     (concat
! 	      "\\(^\\|[^$@%&\\]\\)\\<\\("
  	      ;; "CORE" "__FILE__" "__LINE__" "abs" "accept" "alarm"
  	      ;; "and" "atan2" "bind" "binmode" "bless" "caller"
  	      ;; "chdir" "chmod" "chown" "chr" "chroot" "close"
--- 2909,2915 ----
  					; for overwritable builtins
  	    (list
  	     (concat
! 	      "\\(^\\|[^_$@%&\\]\\)\\<\\("
  	      ;; "CORE" "__FILE__" "__LINE__" "abs" "accept" "alarm"
  	      ;; "and" "atan2" "bind" "binmode" "bless" "caller"
  	      ;; "chdir" "chmod" "chown" "chr" "chroot" "close"
***************
*** 2974,2986 ****
  	      "time\\|mask\\|n\\(pack\\|link\\)\\)\\|v\\(alues\\|ec\\)\\|"
  	      "w\\(a\\(rn\\|it\\(pid\\|\\)\\|ntarray\\)\\|rite\\)\\|"
  	      "x\\(\\|or\\)\\|__\\(FILE__\\|LINE__\\)"
! 	      "\\)\\>") 2 'font-lock-type-face)
  	    ;; In what follows we use `other' style
  	    ;; for nonoverwritable builtins
  	    ;; Somehow 's', 'm' are not auto-generated???
  	    (list
  	     (concat
! 	      "\\(^\\|[^$@%&\\]\\)\\<\\("
  	      ;; "AUTOLOAD" "BEGIN" "DESTROY" "END" "__END__" "chomp"
  	      ;; "chop" "defined" "delete" "do" "each" "else" "elsif"
  	      ;; "eval" "exists" "for" "foreach" "format" "goto"
--- 2974,2986 ----
  	      "time\\|mask\\|n\\(pack\\|link\\)\\)\\|v\\(alues\\|ec\\)\\|"
  	      "w\\(a\\(rn\\|it\\(pid\\|\\)\\|ntarray\\)\\|rite\\)\\|"
  	      "x\\(\\|or\\)\\|__\\(FILE__\\|LINE__\\)"
! 	      "\\)\\>[^_]") 2 'font-lock-type-face)
  	    ;; In what follows we use `other' style
  	    ;; for nonoverwritable builtins
  	    ;; Somehow 's', 'm' are not auto-generated???
  	    (list
  	     (concat
! 	      "\\(^\\|[^_$@%&\\]\\)\\<\\("
  	      ;; "AUTOLOAD" "BEGIN" "DESTROY" "END" "__END__" "chomp"
  	      ;; "chop" "defined" "delete" "do" "each" "else" "elsif"
  	      ;; "eval" "exists" "for" "foreach" "format" "goto"
***************
*** 3000,3006 ****
  	      "u\\(se\\|n\\(shift\\|ti\\(l\\|e\\)\\|def\\|less\\)\\)\\|"
  	      "while\\|y\\|__\\(END\\|DATA\\)__" ;__DATA__ added manually
  	      "\\|[sm]"			; Added manually
! 	      "\\)\\>") 2 'font-lock-other-type-face)
  	    ;;		(mapconcat 'identity
  	    ;;			   '("#endif" "#else" "#ifdef" "#ifndef" "#if"
  	    ;;			     "#include" "#define" "#undef")
--- 3000,3006 ----
  	      "u\\(se\\|n\\(shift\\|ti\\(l\\|e\\)\\|def\\|less\\)\\)\\|"
  	      "while\\|y\\|__\\(END\\|DATA\\)__" ;__DATA__ added manually
  	      "\\|[sm]"			; Added manually
! 	      "\\)\\>[^_]") 2 'font-lock-other-type-face)
  	    ;;		(mapconcat 'identity
  	    ;;			   '("#endif" "#else" "#ifdef" "#ifndef" "#if"
  	    ;;			     "#include" "#define" "#undef")
***************
*** 3027,3033 ****
  		       2 font-lock-string-face t)))
  	    '("[ \t{,(]\\(-?[a-zA-Z0-9_:]+\\)[ \t]*=>" 1
  	      font-lock-string-face t)
! 	    '("^[ \t]*\\([a-zA-Z0-9_]+[ \t]*:\\)[ \t]*\\($\\|{\\|\\<\\(until\\|while\\|for\\(each\\)?\\|do\\)\\>\\)" 1 
  	      font-lock-reference-face) ; labels
  	    '("\\<\\(continue\\|next\\|last\\|redo\\|goto\\)\\>[ \t]+\\([a-zA-Z0-9_:]+\\)" ; labels as targets
  	      2 font-lock-reference-face)
--- 3027,3033 ----
  		       2 font-lock-string-face t)))
  	    '("[ \t{,(]\\(-?[a-zA-Z0-9_:]+\\)[ \t]*=>" 1
  	      font-lock-string-face t)
! 	    '("^[ \t]*\\([a-zA-Z0-9_]+[ \t]*:\\)[ \t]*\\($\\|{\\|\\<\\(until\\|while\\|for\\(each\\)?\\|do\\)\\>[^_]\\)" 1 
  	      font-lock-reference-face) ; labels
  	    '("\\<\\(continue\\|next\\|last\\|redo\\|goto\\)\\>[ \t]+\\([a-zA-Z0-9_:]+\\)" ; labels as targets
  	      2 font-lock-reference-face)
***************
*** 4027,4033 ****
     '("[^-\t <>=+]\\(--\\|\\+\\+\\)"	; var-- var++
       "[a-zA-Z0-9][|&][a-zA-Z0-9$]"	; abc|def abc&def are often used.
       "&[(a-zA-Z0-9$]"			; &subroutine &(var->field)
!      "<\\$?\\sw+\\(\\.\\sw+\\)?>"	; <IN> <stdin.h>
       "-[a-zA-Z][ \t]+[_$\"'`]"		; -f file
       "-[0-9]"				; -5
       "\\+\\+"				; ++var
--- 4027,4033 ----
     '("[^-\t <>=+]\\(--\\|\\+\\+\\)"	; var-- var++
       "[a-zA-Z0-9][|&][a-zA-Z0-9$]"	; abc|def abc&def are often used.
       "&[(a-zA-Z0-9$]"			; &subroutine &(var->field)
!      "<\\$?\\(\\sw\\|\\s_\\)+\\(\\.\\(\\sw\\|\\s_\\)+\\)?>"	; <IN> <stdin.h>
       "-[a-zA-Z][ \t]+[_$\"'`]"		; -f file
       "-[0-9]"				; -5
       "\\+\\+"				; ++var

--Multipart_Sun_Jun_22_18:01:40_1997-1
Content-Type: text/plain; charset=US-ASCII


    Martin> Or, if word syntax is a better choice for `_', it should be used
    Martin> everywhere.  perl is no different from ksh in this regard.

    Martin> Ilya, do you agree to make this minor change?

    Martin> Martin

Regards,

Adrian

--Multipart_Sun_Jun_22_18:01:40_1997-1--

