From b00453052c5e7ca3a5c84ce2d0cb37b863754b70 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 12 May 2003 15:46:02 +0000 Subject: [PATCH] (sgml-namespace-re): New const. (sgml-namespace-face): New face. (sgml-font-lock-keywords-1): Use them. --- lisp/textmodes/sgml-mode.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index 75d56392fa..87c9e820e1 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -239,6 +239,7 @@ separated by a space." :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 @@ separated by a space." "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 "