From xemacs-m  Mon Feb 24 13:28:26 1997
Received: from CNRI.Reston.VA.US (CNRI.Reston.VA.US [132.151.1.1])
	by xemacs.org (8.8.5/8.8.5) with SMTP id NAA14955
	for <xemacs-beta@xemacs.org>; Mon, 24 Feb 1997 13:28:24 -0600 (CST)
Received: from newcnri.cnri.reston.va.us by CNRI.Reston.VA.US id aa14739;
          24 Feb 97 11:41 EST
Received: from anthem.CNRI.Reston.Va.US by newcnri.CNRI.Reston.Va.US (SMI-8.6/SMI-SVR4)
	id LAA16497; Mon, 24 Feb 1997 11:41:25 -0500
Received: by anthem.CNRI.Reston.Va.US (SMI-8.6/SMI-SVR4)
	id LAA16012; Mon, 24 Feb 1997 11:41:24 -0500
Date: Mon, 24 Feb 1997 11:41:24 -0500
Message-Id: <199702241641.LAA16012@anthem.CNRI.Reston.Va.US>
From: "Barry A. Warsaw" <bwarsaw@anthem.cnri.reston.va.us>
MIME-Version: 1.0
Content-Type: multipart/mixed;
	boundary="lP3lox4Px9WclVpzuVG4uQ78MmExbdF7/qGsUCzZ"
Content-Transfer-Encoding: 7bit
To: xemacs-beta@xemacs.org
Subject: font-lock.el mods
Reply-To: "Barry A. Warsaw" <bwarsaw@CNRI.Reston.VA.US>
X-Attribution: BAW
X-Oblique-Strategy: Revert to your original idea
X-Url: http://www.python.org/~bwarsaw


--lP3lox4Px9WclVpzuVG4uQ78MmExbdF7/qGsUCzZ
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


Here's a diff against b95's font-lock.el.  It changes a couple of
things.  Most importantly, it allows the MATCHER in font-lock-keywords
to be a variable containing a regexp (the test actually is if MATCHER
is not a string, not a function, and is boundp, then the symbol-value
is used as the MATCHER).  My upcoming patch to shell.el will take
advantage of this by making it much easier for a user to change the
font-locking shell prompt pattern when they change their
shell-prompt-pattern.  Otherwise they have to hack on
font-lock-keywords in their mode hook.  Ugly.

This change also removes the python-font-lock-keywords definition
since an upcoming patch to python-mode.el will define it correctly.

Maybe if Simon likes these changes, he'll fold them into the FSF
version of font-lock.el. ;-)

-Barry


--lP3lox4Px9WclVpzuVG4uQ78MmExbdF7/qGsUCzZ
Content-Type: text/plain
Content-Disposition: inline;
	filename="patch-6"
Content-Transfer-Encoding: 7bit

*** font-lock.el	1997/02/24 15:40:52	1.1
--- font-lock.el	1997/02/24 16:26:15
***************
*** 275,284 ****
   (MATCH FACENAME OVERRIDE LAXMATCH)
  
! Where MATCHER can be either the regexp to search for, or the function name to
! call to make the search (called with one argument, the limit of the search).
! MATCH is the subexpression of MATCHER to be highlighted.  FACENAME is either
! a symbol naming a face, or an expression whose value is the face name to use.
! If you want FACENAME to be a symbol that evaluates to a face, use a form
! like \"(progn sym)\".
  
  OVERRIDE and LAXMATCH are flags.  If OVERRIDE is t, existing fontification may
--- 275,285 ----
   (MATCH FACENAME OVERRIDE LAXMATCH)
  
! Where MATCHER can be either the regexp to search for, a variable
! containing the regexp to search for, or the function to call to make
! the search (called with one argument, the limit of the search).  MATCH
! is the subexpression of MATCHER to be highlighted.  FACENAME is either
! a symbol naming a face, or an expression whose value is the face name
! to use.  If you want FACENAME to be a symbol that evaluates to a face,
! use a form like \"(progn sym)\".
  
  OVERRIDE and LAXMATCH are flags.  If OVERRIDE is t, existing fontification may
***************
*** 1128,1131 ****
--- 1129,1136 ----
      (save-match-data
        ;; Find an occurrence of `matcher' before `limit'.
+       (if (and (not (stringp matcher))
+ 	       (not (functionp matcher))
+ 	       (boundp matcher))
+ 	  (setq matcher (symbol-value matcher)))
        (while (if (stringp matcher)
  		 (re-search-forward matcher limit t)
***************
*** 1158,1161 ****
--- 1163,1170 ----
  	;; Find an occurrence of `matcher' from `start' to `end'.
  	(setq keyword (car keywords) matcher (car keyword))
+ 	(if (and (not (stringp matcher))
+ 		 (not (functionp matcher))
+ 		 (boundp matcher))
+ 	    (setq matcher (symbol-value matcher)))
  	(goto-char start)
  	(while (and (< (point) end)
***************
*** 2519,2547 ****
     ))
    "Additional expressions to highlight in sh-mode.")
- 
- (defconst python-font-lock-keywords
-   (purecopy
-    (list
-     (cons (concat "\\b\\("
-                   (mapconcat 'identity
-                              '("access"     "del"        "from"
-                                "lambda"     "return"     "and"
-                                "elif"       "global"     "not"
-                                "try:"       "break "     "else:"
-                                "if"         "or"         "while"
-                                "except"     "except:"    "import"
-                                "pass"       "continue"   "finally:"
-                                "in"         "print"      "for"
-                                "is"         "raise")
-                              "\\|")
-                   "\\)[ \n\t(]")
-           1)
-     '("\\bclass[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)"
-       1 font-lock-type-face)
-     '("\\bdef[ \t]+\\([a-zA-Z_]+[a-zA-Z0-9_]*\\)"
-       1 font-lock-function-name-face)
-     ))
-   "Additional expressions to highlight in Python mode.")
- 
  
  
--- 2528,2531 ----

--lP3lox4Px9WclVpzuVG4uQ78MmExbdF7/qGsUCzZ--

