# HG changeset patch # User Stefan Monnier # Date 1052754362 0 # Node ID 7a718ea39fba0ed85a475c79e3ee3eb22a5c441c # Parent e6cae6d37bc99c815ca9066fe9c2c56f78ac8a6d (sgml-namespace-re): New const. (sgml-namespace-face): New face. (sgml-font-lock-keywords-1): Use them. diff -r e6cae6d37bc9 -r 7a718ea39fba lisp/textmodes/sgml-mode.el --- a/lisp/textmodes/sgml-mode.el Mon May 12 15:06:18 2003 +0000 +++ b/lisp/textmodes/sgml-mode.el Mon May 12 15:46:02 2003 +0000 @@ -239,6 +239,7 @@ :type '(choice (const nil) integer) :group 'sgml) +(defconst sgml-namespace-re "[_[:alpha:]][-_.[:alnum:]]*") (defconst sgml-name-re "[_:[:alpha:]][-_.:[:alnum:]]*") (defconst sgml-tag-name-re (concat "<\\([!/?]?" sgml-name-re "\\)")) (defconst sgml-attrs-re "\\(?:[^\"'/><]\\|\"[^\"]*\"\\|'[^']*'\\)*") @@ -246,13 +247,24 @@ "Regular expression that matches a non-empty start tag. Any terminating `>' or `/' is not matched.") +(defface sgml-namespace-face + '((t (:inherit font-lock-builtin-face))) + "`sgml-mode' face used to highlight the namespace part of identifiers.") +(defvar sgml-namespace-face 'sgml-namespace-face) ;; internal (defconst sgml-font-lock-keywords-1 `((,(concat "<\\([!?]" sgml-name-re "\\)") 1 font-lock-keyword-face) - (,(concat "<\\(/?" sgml-name-re"\\)") 1 font-lock-function-name-face) + ;; We could use the simpler "\\(" sgml-namespace-re ":\\)?" instead, + ;; but it would cause a bit more backtracking in the re-matcher. + (,(concat "