changeset 21780:5dc3fe7cd300

(sgml-font-lock-keywords-1): Copy initialization from sgml-font-lock-keywords. (sgml-font-lock-keywords): Initialize from sgml-font-lock-keywords-1. (sgml-font-lock-keywords-2): New variable. (sgml-mode-common): Make buffer-local binding for sgml-font-lock-keywords-2 and initialize it. Use it in font-lock-defaults.
author Richard M. Stallman <rms@gnu.org>
date Mon, 27 Apr 1998 01:22:08 +0000
parents 6aaa0268fe91
children 6e9ef4991da8
files lisp/textmodes/sgml-mode.el
diffstat 1 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/sgml-mode.el	Sun Apr 26 22:36:29 1998 +0000
+++ b/lisp/textmodes/sgml-mode.el	Mon Apr 27 01:22:08 1998 +0000
@@ -205,16 +205,21 @@
 Any terminating `>' or `/' is not matched.")
 
 
-(defvar sgml-font-lock-keywords
+;; internal
+(defconst sgml-font-lock-keywords-1
   '(("<\\([!?][a-z0-9]+\\)" 1 font-lock-keyword-face)
     ("<\\(/?[a-z0-9]+\\)" 1 font-lock-function-name-face)
     ("[&%][-.A-Za-z0-9]+;?" . font-lock-variable-name-face)
-    ("<!--[^<>]*-->" . font-lock-comment-face))
+    ("<!--[^<>]*-->" . font-lock-comment-face)))
+
+(defconst sgml-font-lock-keywords-2 ())
+
+;; for font-lock, but must be defvar'ed after
+;; sgml-font-lock-keywords-1 and sgml-font-lock-keywords-2 above
+(defvar sgml-font-lock-keywords sgml-font-lock-keywords-1
   "*Rules for highlighting SGML code.  See also `sgml-tag-face-alist'.")
 
 ;; internal
-(defvar sgml-font-lock-keywords-1 ())
-
 (defvar sgml-face-tag-alist ()
   "Alist of face and tag name for facemenu.")
 
@@ -273,7 +278,7 @@
 
 (defun sgml-mode-common (sgml-tag-face-alist sgml-display-text)
   "Common code for setting up `sgml-mode' and derived modes.
-SGML-TAG-FACE-ALIST is used for calculating `sgml-font-lock-keywords-1'.
+SGML-TAG-FACE-ALIST is used for calculating `sgml-font-lock-keywords-2'.
 SGML-DISPLAY-TEXT sets up alternate text for when tags are invisible (see
 varables of same name)."
   (kill-all-local-variables)
@@ -294,6 +299,7 @@
   (make-local-variable 'skeleton-end-hook)
   (make-local-variable 'font-lock-defaults)
   (make-local-variable 'sgml-font-lock-keywords-1)
+  (make-local-variable 'sgml-font-lock-keywords-2)
   (make-local-variable 'facemenu-add-face-function)
   (make-local-variable 'facemenu-end-add-face)
   ;;(make-local-variable 'facemenu-remove-face-function)
@@ -327,9 +333,12 @@
 				(not (or (eq v2 '\n)
 					 (eq (car-safe v2) '\n)))
 				(newline-and-indent)))
-	sgml-font-lock-keywords-1 (cdr (assq 1 sgml-tag-face-alist))
+	sgml-font-lock-keywords-2 (append
+				   sgml-font-lock-keywords-1
+				   (cdr (assq 1 sgml-tag-face-alist)))
 	font-lock-defaults '((sgml-font-lock-keywords
-			      sgml-font-lock-keywords-1)
+			      sgml-font-lock-keywords-1
+			      sgml-font-lock-keywords-2)
 			     nil
 			     t)
 	facemenu-add-face-function 'sgml-mode-facemenu-add-face-function)