aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1998-04-27 01:22:08 +0000
committerRichard M. Stallman1998-04-27 01:22:08 +0000
commitc6a635346e792dd12dce4f2b1386bfdce14773ac (patch)
tree94bb58289eef4c0b2fceed10ef1e53d26d766543
parenta76206dcc37bf420bded365c02e89a2192422154 (diff)
downloademacs-c6a635346e792dd12dce4f2b1386bfdce14773ac.tar.gz
emacs-c6a635346e792dd12dce4f2b1386bfdce14773ac.zip
(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.
-rw-r--r--lisp/textmodes/sgml-mode.el23
1 files changed, 16 insertions, 7 deletions
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index eff08965f21..3ce820a5b74 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -205,16 +205,21 @@ separated by a space."
205Any terminating `>' or `/' is not matched.") 205Any terminating `>' or `/' is not matched.")
206 206
207 207
208(defvar sgml-font-lock-keywords 208;; internal
209(defconst sgml-font-lock-keywords-1
209 '(("<\\([!?][a-z0-9]+\\)" 1 font-lock-keyword-face) 210 '(("<\\([!?][a-z0-9]+\\)" 1 font-lock-keyword-face)
210 ("<\\(/?[a-z0-9]+\\)" 1 font-lock-function-name-face) 211 ("<\\(/?[a-z0-9]+\\)" 1 font-lock-function-name-face)
211 ("[&%][-.A-Za-z0-9]+;?" . font-lock-variable-name-face) 212 ("[&%][-.A-Za-z0-9]+;?" . font-lock-variable-name-face)
212 ("<!--[^<>]*-->" . font-lock-comment-face)) 213 ("<!--[^<>]*-->" . font-lock-comment-face)))
214
215(defconst sgml-font-lock-keywords-2 ())
216
217;; for font-lock, but must be defvar'ed after
218;; sgml-font-lock-keywords-1 and sgml-font-lock-keywords-2 above
219(defvar sgml-font-lock-keywords sgml-font-lock-keywords-1
213 "*Rules for highlighting SGML code. See also `sgml-tag-face-alist'.") 220 "*Rules for highlighting SGML code. See also `sgml-tag-face-alist'.")
214 221
215;; internal 222;; internal
216(defvar sgml-font-lock-keywords-1 ())
217
218(defvar sgml-face-tag-alist () 223(defvar sgml-face-tag-alist ()
219 "Alist of face and tag name for facemenu.") 224 "Alist of face and tag name for facemenu.")
220 225
@@ -273,7 +278,7 @@ an optional alist of possible values."
273 278
274(defun sgml-mode-common (sgml-tag-face-alist sgml-display-text) 279(defun sgml-mode-common (sgml-tag-face-alist sgml-display-text)
275 "Common code for setting up `sgml-mode' and derived modes. 280 "Common code for setting up `sgml-mode' and derived modes.
276SGML-TAG-FACE-ALIST is used for calculating `sgml-font-lock-keywords-1'. 281SGML-TAG-FACE-ALIST is used for calculating `sgml-font-lock-keywords-2'.
277SGML-DISPLAY-TEXT sets up alternate text for when tags are invisible (see 282SGML-DISPLAY-TEXT sets up alternate text for when tags are invisible (see
278varables of same name)." 283varables of same name)."
279 (kill-all-local-variables) 284 (kill-all-local-variables)
@@ -294,6 +299,7 @@ varables of same name)."
294 (make-local-variable 'skeleton-end-hook) 299 (make-local-variable 'skeleton-end-hook)
295 (make-local-variable 'font-lock-defaults) 300 (make-local-variable 'font-lock-defaults)
296 (make-local-variable 'sgml-font-lock-keywords-1) 301 (make-local-variable 'sgml-font-lock-keywords-1)
302 (make-local-variable 'sgml-font-lock-keywords-2)
297 (make-local-variable 'facemenu-add-face-function) 303 (make-local-variable 'facemenu-add-face-function)
298 (make-local-variable 'facemenu-end-add-face) 304 (make-local-variable 'facemenu-end-add-face)
299 ;;(make-local-variable 'facemenu-remove-face-function) 305 ;;(make-local-variable 'facemenu-remove-face-function)
@@ -327,9 +333,12 @@ varables of same name)."
327 (not (or (eq v2 '\n) 333 (not (or (eq v2 '\n)
328 (eq (car-safe v2) '\n))) 334 (eq (car-safe v2) '\n)))
329 (newline-and-indent))) 335 (newline-and-indent)))
330 sgml-font-lock-keywords-1 (cdr (assq 1 sgml-tag-face-alist)) 336 sgml-font-lock-keywords-2 (append
337 sgml-font-lock-keywords-1
338 (cdr (assq 1 sgml-tag-face-alist)))
331 font-lock-defaults '((sgml-font-lock-keywords 339 font-lock-defaults '((sgml-font-lock-keywords
332 sgml-font-lock-keywords-1) 340 sgml-font-lock-keywords-1
341 sgml-font-lock-keywords-2)
333 nil 342 nil
334 t) 343 t)
335 facemenu-add-face-function 'sgml-mode-facemenu-add-face-function) 344 facemenu-add-face-function 'sgml-mode-facemenu-add-face-function)