终于想通了.答案是,fontification规则中的"override"参数应设置为t,这意味着给定的face将覆盖字符串face.有关详细信息,请参阅变量"font-lock-keywords"的文档.这是一个例子:
(define-derived-mode temp-mode fundamental-mode "Temp"
"Temporary major mode."
(set (make-local-variable 'font-lock-defaults)
'((temp-mode-font-lock-keywords) nil nil nil nil)))
(defconst temp-mode-font-lock-keywords
(list (list "$[A-Za-z0-9]+" 0 font-lock-variable-name-face t)))